Compare commits

..
48 Commits
Author SHA1 Message Date
Jesse Thilo e7ae9cfb47 Bumped version number to 1.27. 1999-02-16 11:05:48 +00:00
Jesse Thilo 5c31c3c2c8 #Updated NEWS for 1.27. 1999-02-16 11:05:33 +00:00
Jesse Thilo e569a4351c Added bison.simple' to list of files removed by make distclean'. 1999-02-16 11:05:16 +00:00
Jesse Thilo 9eceb6c6d3 Defined locations of parser files in config.h instead of Makefile. 1999-02-12 15:18:12 +00:00
Jesse Thilo 315f05ae6c Removed inappropriate use of $< macro. 1999-02-09 03:51:09 +00:00
Jesse Thilo f35167cb24 # 1999-02-05 15:06:29 +00:00
Jesse Thilo 8cd0d0f2ce Add `po' directory skeleton. 1999-02-05 15:05:15 +00:00
Jesse Thilo f51dbca105 #updated. 1999-01-27 03:35:18 +00:00
Jesse Thilo 97088b85c5 Document help-bison list. 1999-01-27 03:34:47 +00:00
Jesse Thilo 8d57fff0a9 Add check for mkstemp(). 1999-01-27 03:26:56 +00:00
Jesse Thilo cbbe75051d #Remove static from dummy(). 1999-01-20 22:56:40 +00:00
Jesse Thilo 2686a6e713 Hush a few compiler warnings. 1999-01-20 22:55:06 +00:00
Jesse Thilo a693bf18ef Add tryclose(), which verifies that fclose was successful.
Hush a couple of compiler warnings.
1999-01-20 22:53:23 +00:00
Jesse Thilo 29620c5d9c ChangeLog is now automatically generated. Include the old version as
OChangeLog.
1999-01-20 22:45:49 +00:00
Jesse Thilo 2d97f5ccb7 Fix formatting glitch. 1999-01-14 15:08:17 +00:00
Jesse Thilo c49a8e71ce Update FSF address. 1999-01-14 14:58:38 +00:00
Jesse Thilo c9c4ffaa5d Don't define PACKAGE here, since config.h defines it. 1999-01-08 21:17:26 +00:00
Jesse Thilo 74a53b4b48 Update copyright date. 1998-12-30 06:54:16 +00:00
Jesse Thilo a889d44ce2 Ditch sprintf to statically-sized buffers in fatal/warn functions in
favor of output directly to stderr (avoids buffer overruns).
1998-12-30 06:29:42 +00:00
Jesse Thilo e6011337c3 Some checks for premature EOF. 1998-12-30 06:07:25 +00:00
Jesse Thilo d2729d44ab Use prototypes if the compiler understands them. 1998-12-30 05:27:11 +00:00
Jesse Thilo 4be07551f5 Document 1.26 highlights. 1998-12-30 05:24:36 +00:00
Jesse Thilo 0308924772 Delete comment "consider using @set for edition number, etc..." since
we now are doing so.
1998-12-30 05:24:00 +00:00
Jesse Thilo 3202e65182 Require Automake 1.3 or later. 1998-12-30 05:23:22 +00:00
Jesse Thilo bd088c911c Honor TMPDIR on Unix hosts.
Use prototypes if the compiler understands them.
1998-12-30 05:22:02 +00:00
Jesse Thilo 118fb2053c Fix a couple of buffer overrun bugs.
Use prototypes if the compiler understands them.
1998-12-30 05:21:02 +00:00
Jesse Thilo 7bb4d91420 Include unistd.h and ctype.h.
Use #ifdef instead of #if for NLS symbols.
1998-12-30 05:19:09 +00:00
Jesse Thilo bd2a2393ed Use VERSION symbol from automake for version number. 1998-12-29 21:54:26 +00:00
Jesse Thilo bd773d7399 Add info dir entry. 1998-11-28 21:44:16 +00:00
Jesse Thilo de4d0c7525 Distribute original version of simple parser (bison.s1), not built
version (bison.simple).
1998-11-28 21:31:37 +00:00
Jesse Thilo 792d6b7cda # 1998-11-28 21:30:44 +00:00
Jesse Thilo df1af54c81 Let automake put version number into documentation. 1998-11-28 21:30:44 +00:00
Jesse Thilo c55c697eb1 Add non-RCS files from /gd/gnu/bison. 1998-11-26 00:44:18 +00:00
Jesse Thilo 9e4e995adb Document the BISON_HAIRY and BISON_SIMPLE variables. 1998-11-26 00:14:37 +00:00
Jesse Thilo 604cc97b12 # 1998-11-25 23:52:35 +00:00
Jesse Thilo 5b2a15fd2f # 1998-11-25 23:40:54 +00:00
Jesse Thilo f310d2132a Rename bison.simple to bison.s1 (bison.simple is then built from bison.s1). 1998-11-25 23:18:48 +00:00
Jesse Thilo 6f82addcd5 Build version.c automatically. 1998-11-25 23:17:35 +00:00
Jesse Thilo 4562bb7764 # 1998-11-25 23:17:05 +00:00
Jesse Thilo 341a3cfb10 Add AUTHORS file. 1998-11-25 22:13:23 +00:00
Jesse Thilo 5b2e3c8982 Fix token numbering (used to start at 258, not 257). 1998-11-25 22:13:09 +00:00
Jesse Thilo d968a24b6e Include config.h. 1998-11-25 22:12:45 +00:00
Jesse Thilo 6f515a274e Clean up some formatting. 1998-11-25 22:11:01 +00:00
Jesse Thilo 5c9ba6311a Update bug report address. 1998-11-25 22:09:19 +00:00
Jesse Thilo bc77bc1cd2 Rename bison.simple to bison.s1 (bison.simple is then built from bison.s1). 1998-11-25 21:55:23 +00:00
Jesse Thilo 11443f4acf Get latest copies of alloca.c, getopt.c, getopt.h, getopt1.c from gnu.org. 1998-11-25 21:40:21 +00:00
Jesse Thilo ab1375029c Add automake stuff. 1998-11-25 21:36:05 +00:00
Jesse Thilo b059f9990f # 1998-11-25 21:36:05 +00:00
55 changed files with 4542 additions and 1510 deletions
+31
View File
@@ -0,0 +1,31 @@
.deps
ChangeLog
Makefile
Makefile.in
aclocal.m4
bison
bison.aux
bison.cp
bison.cps
bison.dvi
bison.fn
bison.info
bison.info-[0-9]*
bison.ky
bison.log
bison.pg
bison.ps
bison.simple
bison.toc
bison.tp
bison.vr
config.cache
config.h
config.hin
config.log
config.status
configure
stamp-h
stamp-vti
version.c
version.texi
+8
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.
+30
View File
@@ -0,0 +1,30 @@
## Process this file with automake to produce Makefile.in -*-Makefile-*-
AUTOMAKE_OPTIONS = 1.4
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 version.c getopt.c \
getopt1.c
EXTRA_bison_SOURCES = vmsgetargs.c
bison_LDADD = @ALLOCA@
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
info_TEXINFOS = bison.texinfo
man_MANS = bison.1
EXTRA_DIST = bison.1 bison.s1 bison.hairy REFERENCES configure.bat \
build.com bison.cld bison.rnh vmshlp.mar OChangeLog
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
-200
View File
@@ -1,200 +0,0 @@
# 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.
#### Start of system configuration section. ####
srcdir = @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 = @CFLAGS@
LDFLAGS = @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
# where the parsers go
datadir = $(prefix)/share
# where the info files go
infodir = $(prefix)/info
# where manual pages go and what their extensions should be
mandir = $(prefix)/man/man$(manext)
manext = 1
# hope this works on non-gnu makes.
bison_version = `sed -e '/version_string/!d' -e 's/[^0-9.]*\([0-9.]*\).*/\1/' -e q version.c`
#### End of system configuration section. ####
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 alloc.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
SHELL = /bin/sh
# 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) $<
# names of parser files
PFILE = bison.simple
PFILE1 = bison.hairy
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)
all: bison bison.info bison.s1
Makefile: config.status Makefile.in
CONFIG_FILES=$@ CONFIG_HEADERS= ./config.status
config.status: configure
./config.status --recheck
configure: configure.in
cd $(srcdir) && autoconf
# 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|" -e "s/@bison_version@/$(bison_version)/" < $(srcdir)/$(PFILE) > $@-tmp
mv $@-tmp $@
clean:
rm -f *.o core bison bison.s1 config.status config.log
mostlyclean: clean
distclean: clean
rm -f Makefile
realclean: distclean
rm -f TAGS *.info*
# 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)
# Make sure all installation directories, e.g. $(bindir) actually exist by
# making them if necessary.
installdirs:
-sh $(srcdir)/mkinstalldirs $(bindir) $(datadir) $(libdir) $(infodir) $(mandir)
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)."
bison: $(OBJECTS)
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(OBJECTS) $(LIBS)
# 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-$(bison_version) > .fname
-rm -rf `cat .fname`
mkdir `cat .fname`
dst=`cat .fname`; for f in $(DISTFILES); do \
if test -L $$f; then \
cp $$f $$dst/$$f; chmod a-w $$dst/$$f; \
else \
ln $$f $$dst/$$f; \
fi \
done
tar --gzip -chf `cat .fname`.tar.gz `cat .fname`
-rm -rf `cat .fname` .fname
bison.info: bison.texinfo
$(MAKEINFO) $(srcdir)/bison.texinfo
TAGS: *.c *.h
etags *.c *.h
# 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)
LR0.o: system.h machine.h alloc.h gram.h state.h
allocate.o: system.h
closure.o: system.h machine.h alloc.h gram.h
conflicts.o: system.h machine.h alloc.h files.h gram.h state.h
derives.o: system.h alloc.h types.h gram.h
files.o: system.h files.h alloc.h gram.h
getargs.o: system.h files.h
lalr.o: system.h machine.h types.h state.h alloc.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 alloc.h
output.o: system.h machine.h alloc.h files.h gram.h state.h
print.o: system.h machine.h alloc.h files.h gram.h state.h
reader.o: system.h files.h alloc.h symtab.h lex.h gram.h
reduce.o: system.h machine.h files.h alloc.h gram.h
symtab.o: system.h alloc.h symtab.h gram.h
warshall.o: system.h machine.h
# Prevent GNU make v3 from overflowing arg limit on SysV.
.NOEXPORT:
+23 -1
View File
@@ -1,7 +1,29 @@
Bison News
----------
Change in version 1.25:
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: <[email protected]> and <[email protected]>.
* 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.
+1430
View File
File diff suppressed because it is too large Load Diff
+6 -3
View File
@@ -10,6 +10,9 @@ 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-[email protected]. Please include the
version number from `bison --version', and a complete, self-contained
test case in each bug report.
Send bug reports to bug-[email protected]. 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 [email protected].
+27
View File
@@ -0,0 +1,27 @@
#ifndef CONFIG_H
#define CONFIG_H
@TOP@
/* Name of package. */
#undef PACKAGE
/* Version of package. */
#undef VERSION
/* Define if the compiler understands prototypes. */
#undef PROTOTYPES
/* The location of the simple parser (bison.simple). */
#undef XPFILE
/* The location of the semantic parser (bison.hairy). */
#undef XPFILE1
@BOTTOM@
#if defined(PROTOTYPES) || defined(__cplusplus)
# define PARAMS(p) p
#else
# define PARAMS(p) ()
#endif
#endif /* CONFIG_H */
+13
View File
@@ -0,0 +1,13 @@
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 <[email protected]>
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")
])
-760
View File
@@ -1,760 +0,0 @@
/* -*-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.
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 later version.
This program 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 this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, 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. */
/* 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 /* [email protected] 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. */
#define yyerrok (yyerrstatus = 0)
#define yyclearin (yychar = YYEMPTY)
#define YYEMPTY -2
#define YYEOF 0
#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
transition to the new meaning of YYERROR, for GCC.
Once GCC version 2 has supplanted version 1, this can go. */
#define YYFAIL goto yyerrlab
#define YYRECOVERING() (!!yyerrstatus)
#define YYBACKUP(token, value) \
do \
if (yychar == YYEMPTY && yylen == 1) \
{ yychar = (token), yylval = (value); \
yychar1 = YYTRANSLATE (yychar); \
YYPOPSTACK; \
goto yybackup; \
} \
else \
{ yyerror ("syntax error: cannot back up"); YYERROR; } \
while (0)
#define YYTERROR 1
#define YYERRCODE 256
#ifndef YYPURE
#define YYLEX yylex()
#endif
#ifdef YYPURE
#ifdef YYLSP_NEEDED
#ifdef YYLEX_PARAM
#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
#else
#define YYLEX yylex(&yylval, &yylloc)
#endif
#else /* not YYLSP_NEEDED */
#ifdef YYLEX_PARAM
#define YYLEX yylex(&yylval, YYLEX_PARAM)
#else
#define YYLEX yylex(&yylval)
#endif
#endif /* not YYLSP_NEEDED */
#endif
/* If nonreentrant, generate the variables here */
#ifndef YYPURE
int yychar; /* the lookahead symbol */
YYSTYPE yylval; /* the semantic value of the */
/* lookahead symbol */
#ifdef YYLSP_NEEDED
YYLTYPE yylloc; /* location data for the lookahead */
/* symbol */
#endif
int yynerrs; /* number of parse errors so far */
#endif /* not YYPURE */
#if YYDEBUG != 0
int yydebug; /* nonzero means print parse trace */
/* Since this is uninitialized, it does not stop multiple parsers
from coexisting. */
#endif
/* YYINITDEPTH indicates the initial size of the parser's stacks */
#ifndef YYINITDEPTH
#define YYINITDEPTH 200
#endif
/* YYMAXDEPTH is the maximum size the stacks can grow to
(effective only if the built-in stack extension method is used). */
#if YYMAXDEPTH == 0
#undef YYMAXDEPTH
#endif
#ifndef YYMAXDEPTH
#define YYMAXDEPTH 10000
#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++ */
#ifndef __cplusplus
/* This is the most reliable way to avoid incompatibilities
in available built-in functions on various systems. */
static void
__yy_memcpy (to, from, count)
char *to;
char *from;
unsigned int count;
{
register char *f = from;
register char *t = to;
register int i = count;
while (i-- > 0)
*t++ = *f++;
}
#else /* __cplusplus */
/* 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, unsigned int count)
{
register char *t = to;
register char *f = from;
register int i = count;
while (i-- > 0)
*t++ = *f++;
}
#endif
#endif
#line 216 "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 *.
It should actually point to an object.
Grammar actions can access the variable by casting it
to the proper pointer type. */
#ifdef YYPARSE_PARAM
#ifdef __cplusplus
#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
#define YYPARSE_PARAM_DECL
#else /* not __cplusplus */
#define YYPARSE_PARAM_ARG YYPARSE_PARAM
#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
#endif /* not __cplusplus */
#else /* not YYPARSE_PARAM */
#define YYPARSE_PARAM_ARG
#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
{
register int yystate;
register int yyn;
register short *yyssp;
register YYSTYPE *yyvsp;
int yyerrstatus; /* number of tokens to shift before error messages enabled */
int yychar1 = 0; /* lookahead token as an internal (translated) token number */
short yyssa[YYINITDEPTH]; /* the state stack */
YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
short *yyss = yyssa; /* refer to the stacks thru separate pointers */
YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
#ifdef YYLSP_NEEDED
YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
YYLTYPE *yyls = yylsa;
YYLTYPE *yylsp;
#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
#else
#define YYPOPSTACK (yyvsp--, yyssp--)
#endif
int yystacksize = YYINITDEPTH;
int yyfree_stacks = 0;
#ifdef YYPURE
int yychar;
YYSTYPE yylval;
int yynerrs;
#ifdef YYLSP_NEEDED
YYLTYPE yylloc;
#endif
#endif
YYSTYPE yyval; /* the variable used to return */
/* semantic values from the action */
/* routines */
int yylen;
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Starting parse\n");
#endif
yystate = 0;
yyerrstatus = 0;
yynerrs = 0;
yychar = YYEMPTY; /* Cause a token to be read. */
/* Initialize stack pointers.
Waste one element of value and location stack
so that they stay on the same level as the state stack.
The wasted elements are never initialized. */
yyssp = yyss - 1;
yyvsp = yyvs;
#ifdef YYLSP_NEEDED
yylsp = yyls;
#endif
/* Push a new state, which is found in yystate . */
/* In all cases, when you get here, the value and location stacks
have just been pushed. so pushing a state here evens the stacks. */
yynewstate:
*++yyssp = yystate;
if (yyssp >= yyss + yystacksize - 1)
{
/* Give user a chance to reallocate the stack */
/* Use copies of these so that the &'s don't force the real ones into memory. */
YYSTYPE *yyvs1 = yyvs;
short *yyss1 = yyss;
#ifdef YYLSP_NEEDED
YYLTYPE *yyls1 = yyls;
#endif
/* Get the current used size of the three stacks, in elements. */
int size = yyssp - yyss + 1;
#ifdef yyoverflow
/* Each stack pointer address is followed by the size of
the data in use in that stack, in bytes. */
#ifdef YYLSP_NEEDED
/* This used to be a conditional around just the two extra args,
but that might be undefined if yyoverflow is a macro. */
yyoverflow("parser stack overflow",
&yyss1, size * sizeof (*yyssp),
&yyvs1, size * sizeof (*yyvsp),
&yyls1, size * sizeof (*yylsp),
&yystacksize);
#else
yyoverflow("parser stack overflow",
&yyss1, size * sizeof (*yyssp),
&yyvs1, size * sizeof (*yyvsp),
&yystacksize);
#endif
yyss = yyss1; yyvs = yyvs1;
#ifdef YYLSP_NEEDED
yyls = yyls1;
#endif
#else /* no yyoverflow */
/* Extend the stack our own way. */
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;
#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 *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
__yy_memcpy ((char *)yyls, (char *)yyls1,
size * (unsigned int) sizeof (*yylsp));
#endif
#endif /* no yyoverflow */
yyssp = yyss + size - 1;
yyvsp = yyvs + size - 1;
#ifdef YYLSP_NEEDED
yylsp = yyls + size - 1;
#endif
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Stack size increased to %d\n", yystacksize);
#endif
if (yyssp >= yyss + yystacksize - 1)
YYABORT;
}
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Entering state %d\n", yystate);
#endif
goto yybackup;
yybackup:
/* Do appropriate processing given the current state. */
/* Read a lookahead token if we need one and don't already have one. */
/* yyresume: */
/* First try to decide what to do without reference to lookahead token. */
yyn = yypact[yystate];
if (yyn == YYFLAG)
goto yydefault;
/* Not known => get a lookahead token if don't already have one. */
/* yychar is either YYEMPTY or YYEOF
or a valid token in external form. */
if (yychar == YYEMPTY)
{
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Reading a token: ");
#endif
yychar = YYLEX;
}
/* Convert token to internal form (in yychar1) for indexing tables with */
if (yychar <= 0) /* This means end of input. */
{
yychar1 = 0;
yychar = YYEOF; /* Don't call YYLEX any more */
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Now at end of input.\n");
#endif
}
else
{
yychar1 = YYTRANSLATE(yychar);
#if YYDEBUG != 0
if (yydebug)
{
fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
/* Give the individual parser a way to print the precise meaning
of a token, for further debugging info. */
#ifdef YYPRINT
YYPRINT (stderr, yychar, yylval);
#endif
fprintf (stderr, ")\n");
}
#endif
}
yyn += yychar1;
if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
goto yydefault;
yyn = yytable[yyn];
/* yyn is what to do for this token type in this state.
Negative => reduce, -yyn is rule number.
Positive => shift, yyn is new state.
New state is final state => don't bother to shift,
just return success.
0, or most negative number => error. */
if (yyn < 0)
{
if (yyn == YYFLAG)
goto yyerrlab;
yyn = -yyn;
goto yyreduce;
}
else if (yyn == 0)
goto yyerrlab;
if (yyn == YYFINAL)
YYACCEPT;
/* Shift the lookahead token. */
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
#endif
/* Discard the token being shifted unless it is eof. */
if (yychar != YYEOF)
yychar = YYEMPTY;
*++yyvsp = yylval;
#ifdef YYLSP_NEEDED
*++yylsp = yylloc;
#endif
/* count tokens shifted since error; after three, turn off error status. */
if (yyerrstatus) yyerrstatus--;
yystate = yyn;
goto yynewstate;
/* Do the default action for the current state. */
yydefault:
yyn = yydefact[yystate];
if (yyn == 0)
goto yyerrlab;
/* Do a reduction. yyn is the number of a rule to reduce with. */
yyreduce:
yylen = yyr2[yyn];
if (yylen > 0)
yyval = yyvsp[1-yylen]; /* implement default value of the action */
#if YYDEBUG != 0
if (yydebug)
{
int i;
fprintf (stderr, "Reducing via rule %d (line %d), ",
yyn, yyrline[yyn]);
/* Print the symbols being reduced, and their result. */
for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
fprintf (stderr, "%s ", yytname[yyrhs[i]]);
fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
}
#endif
$ /* the action file gets copied in in place of this dollarsign */
#line 542 "bison.simple"
yyvsp -= yylen;
yyssp -= yylen;
#ifdef YYLSP_NEEDED
yylsp -= yylen;
#endif
#if YYDEBUG != 0
if (yydebug)
{
short *ssp1 = yyss - 1;
fprintf (stderr, "state stack now");
while (ssp1 != yyssp)
fprintf (stderr, " %d", *++ssp1);
fprintf (stderr, "\n");
}
#endif
*++yyvsp = yyval;
#ifdef YYLSP_NEEDED
yylsp++;
if (yylen == 0)
{
yylsp->first_line = yylloc.first_line;
yylsp->first_column = yylloc.first_column;
yylsp->last_line = (yylsp-1)->last_line;
yylsp->last_column = (yylsp-1)->last_column;
yylsp->text = 0;
}
else
{
yylsp->last_line = (yylsp+yylen-1)->last_line;
yylsp->last_column = (yylsp+yylen-1)->last_column;
}
#endif
/* Now "shift" the result of the reduction.
Determine what state that goes to,
based on the state we popped back to
and the rule number reduced by. */
yyn = yyr1[yyn];
yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
yystate = yytable[yystate];
else
yystate = yydefgoto[yyn - YYNTBASE];
goto yynewstate;
yyerrlab: /* here on detecting error */
if (! yyerrstatus)
/* If not already recovering from an error, report this error. */
{
++yynerrs;
#ifdef YYERROR_VERBOSE
yyn = yypact[yystate];
if (yyn > YYFLAG && yyn < YYLAST)
{
int size = 0;
char *msg;
int x, count;
count = 0;
/* Start X at -yyn if nec to avoid negative indexes in yycheck. */
for (x = (yyn < 0 ? -yyn : 0);
x < (sizeof(yytname) / sizeof(char *)); x++)
if (yycheck[x + yyn] == x)
size += strlen(yytname[x]) + 15, count++;
msg = (char *) malloc(size + 15);
if (msg != 0)
{
strcpy(msg, "parse error");
if (count < 5)
{
count = 0;
for (x = (yyn < 0 ? -yyn : 0);
x < (sizeof(yytname) / sizeof(char *)); x++)
if (yycheck[x + yyn] == x)
{
strcat(msg, count == 0 ? ", expecting `" : " or `");
strcat(msg, yytname[x]);
strcat(msg, "'");
count++;
}
}
yyerror(msg);
free(msg);
}
else
yyerror ("parse error; also virtual memory exceeded");
}
else
#endif /* YYERROR_VERBOSE */
yyerror("parse error");
}
goto yyerrlab1;
yyerrlab1: /* here on error raised explicitly by an action */
if (yyerrstatus == 3)
{
/* if just tried and failed to reuse lookahead token after an error, discard it. */
/* return failure if at end of input */
if (yychar == YYEOF)
YYABORT;
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
#endif
yychar = YYEMPTY;
}
/* Else will try to reuse lookahead token
after shifting the error token. */
yyerrstatus = 3; /* Each real token shifted decrements this */
goto yyerrhandle;
yyerrdefault: /* current state does not do anything special for the error token. */
#if 0
/* This is wrong; only states that explicitly want error tokens
should shift them. */
yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
if (yyn) goto yydefault;
#endif
yyerrpop: /* pop the current state because it cannot handle the error token */
if (yyssp == yyss) YYABORT;
yyvsp--;
yystate = *--yyssp;
#ifdef YYLSP_NEEDED
yylsp--;
#endif
#if YYDEBUG != 0
if (yydebug)
{
short *ssp1 = yyss - 1;
fprintf (stderr, "Error: state stack now");
while (ssp1 != yyssp)
fprintf (stderr, " %d", *++ssp1);
fprintf (stderr, "\n");
}
#endif
yyerrhandle:
yyn = yypact[yystate];
if (yyn == YYFLAG)
goto yyerrdefault;
yyn += YYTERROR;
if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
goto yyerrdefault;
yyn = yytable[yyn];
if (yyn < 0)
{
if (yyn == YYFLAG)
goto yyerrpop;
yyn = -yyn;
goto yyreduce;
}
else if (yyn == 0)
goto yyerrpop;
if (yyn == YYFINAL)
YYACCEPT;
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Shifting error token, ");
#endif
*++yyvsp = yylval;
#ifdef YYLSP_NEEDED
*++yylsp = yylloc;
#endif
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;
}
+21 -5
View File
@@ -1,22 +1,38 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(reduce.c)
AM_INIT_AUTOMAKE(bison,1.27)
AM_CONFIG_HEADER(config.h:config.hin)
AC_PREREQ(2.13)
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)
PFILE="${datadir}/bison.simple"
BISON_DEFINE_FILE(XPFILE, PFILE)
PFILE1="${datadir}/bison.hairy"
BISON_DEFINE_FILE(XPFILE1, PFILE1)
AC_OUTPUT(Makefile)
+11
View File
@@ -328,6 +328,17 @@ will be removed, because it is incompatible with the POSIX.2 standard.
/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
+22 -13
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.
@@ -3391,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;
@@ -3726,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.
+6
View File
@@ -0,0 +1,6 @@
Makefile
Makefile.in
POTFILES
bison.pot
cat-id-tbl.c
stamp-cat-id
+248
View File
@@ -0,0 +1,248 @@
# Makefile for program source directory in GNU NLS utilities package.
# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <[email protected]>
#
# This file file 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.
PACKAGE = @PACKAGE@
VERSION = @VERSION@
SHELL = /bin/sh
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
datadir = $(prefix)/@DATADIRNAME@
localedir = $(datadir)/locale
gnulocaledir = $(prefix)/share/locale
gettextsrcdir = $(prefix)/share/gettext/po
subdir = po
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
MKINSTALLDIRS = $(top_srcdir)/@MKINSTALLDIRS@
CC = @CC@
GENCAT = @GENCAT@
GMSGFMT = PATH=../src:$$PATH @GMSGFMT@
MSGFMT = @MSGFMT@
XGETTEXT = PATH=../src:$$PATH @XGETTEXT@
MSGMERGE = PATH=../src:$$PATH msgmerge
DEFS = @DEFS@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
INCLUDES = -I.. -I$(top_srcdir)/intl
COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
SOURCES = cat-id-tbl.c
POFILES = @POFILES@
GMOFILES = @GMOFILES@
DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(PACKAGE).pot \
stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES)
POTFILES = \
CATALOGS = @CATALOGS@
CATOBJEXT = @CATOBJEXT@
INSTOBJEXT = @INSTOBJEXT@
.SUFFIXES:
.SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
.c.o:
$(COMPILE) $<
.po.pox:
$(MAKE) $(PACKAGE).pot
$(MSGMERGE) $< $(srcdir)/$(PACKAGE).pot -o $*.pox
.po.mo:
$(MSGFMT) -o $@ $<
.po.gmo:
file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
&& rm -f $$file && $(GMSGFMT) -o $$file $<
.po.cat:
sed -f ../intl/po2msg.sed < $< > $*.msg \
&& rm -f $@ && $(GENCAT) $@ $*.msg
all: all-@USE_NLS@
all-yes: cat-id-tbl.c $(CATALOGS)
all-no:
$(srcdir)/$(PACKAGE).pot: $(POTFILES)
$(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \
--add-comments --keyword=_ --keyword=N_ \
--files-from=$(srcdir)/POTFILES.in \
&& test ! -f $(PACKAGE).po \
|| ( rm -f $(srcdir)/$(PACKAGE).pot \
&& mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot )
$(srcdir)/cat-id-tbl.c: stamp-cat-id; @:
$(srcdir)/stamp-cat-id: $(PACKAGE).pot
rm -f cat-id-tbl.tmp
sed -f ../intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \
| sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp
if cmp -s cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; then \
rm cat-id-tbl.tmp; \
else \
echo cat-id-tbl.c changed; \
rm -f $(srcdir)/cat-id-tbl.c; \
mv cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; \
fi
cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id
install: install-exec install-data
install-exec:
install-data: install-data-@USE_NLS@
install-data-no: all
install-data-yes: all
if test -r "$(MKINSTALLDIRS)"; then \
$(MKINSTALLDIRS) $(datadir); \
else \
$(SHELL) $(top_srcdir)/mkinstalldirs $(datadir); \
fi
@catalogs='$(CATALOGS)'; \
for cat in $$catalogs; do \
cat=`basename $$cat`; \
case "$$cat" in \
*.gmo) destdir=$(gnulocaledir);; \
*) destdir=$(localedir);; \
esac; \
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
dir=$$destdir/$$lang/LC_MESSAGES; \
if test -r "$(MKINSTALLDIRS)"; then \
$(MKINSTALLDIRS) $$dir; \
else \
$(SHELL) $(top_srcdir)/mkinstalldirs $$dir; \
fi; \
if test -r $$cat; then \
$(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \
else \
$(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
echo "installing $(srcdir)/$$cat as" \
"$$dir/$(PACKAGE)$(INSTOBJEXT)"; \
fi; \
if test -r $$cat.m; then \
$(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
else \
if test -r $(srcdir)/$$cat.m ; then \
$(INSTALL_DATA) $(srcdir)/$$cat.m \
$$dir/$(PACKAGE)$(INSTOBJEXT).m; \
echo "installing $(srcdir)/$$cat as" \
"$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
else \
true; \
fi; \
fi; \
done
if test "$(PACKAGE)" = "gettext"; then \
if test -r "$(MKINSTALLDIRS)"; then \
$(MKINSTALLDIRS) $(gettextsrcdir); \
else \
$(SHELL) $(top_srcdir)/mkinstalldirs $(gettextsrcdir); \
fi; \
$(INSTALL_DATA) $(srcdir)/Makefile.in.in \
$(gettextsrcdir)/Makefile.in.in; \
else \
: ; \
fi
# Define this as empty until I found a useful application.
installcheck:
uninstall:
catalogs='$(CATALOGS)'; \
for cat in $$catalogs; do \
cat=`basename $$cat`; \
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
done
rm -f $(gettextsrcdir)/po-Makefile.in.in
check: all
cat-id-tbl.o: ../intl/libgettext.h
dvi info tags TAGS ID:
mostlyclean:
rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp
rm -fr *.o
clean: mostlyclean
distclean: clean
rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
maintainer-clean: distclean
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
rm -f $(GMOFILES)
distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
dist distdir: update-po $(DISTFILES)
dists="$(DISTFILES)"; \
for file in $$dists; do \
ln $(srcdir)/$$file $(distdir) 2> /dev/null \
|| cp -p $(srcdir)/$$file $(distdir); \
done
update-po: Makefile
$(MAKE) $(PACKAGE).pot
PATH=`pwd`/../src:$$PATH; \
cd $(srcdir); \
catalogs='$(CATALOGS)'; \
for cat in $$catalogs; do \
cat=`basename $$cat`; \
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
mv $$lang.po $$lang.old.po; \
echo "$$lang:"; \
if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \
rm -f $$lang.old.po; \
else \
echo "msgmerge for $$cat failed!"; \
rm -f $$lang.po; \
mv $$lang.old.po $$lang.po; \
fi; \
done
POTFILES: POTFILES.in
( if test 'x$(srcdir)' != 'x.'; then \
posrcprefix='$(top_srcdir)/'; \
else \
posrcprefix="../"; \
fi; \
rm -f $@-t $@ \
&& (sed -e '/^#/d' -e '/^[ ]*$$/d' \
-e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
| sed -e '$$s/\\$$//') > $@-t \
&& chmod a-w $@-t \
&& mv $@-t $@ )
Makefile: Makefile.in.in ../config.status POTFILES
cd .. \
&& CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
$(SHELL) ./config.status
# Tell versions [3.59,3.63) of GNU make not to export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
+22
View File
@@ -0,0 +1,22 @@
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
version.c
getopt.c
getopt1.c
+36 -33
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.
@@ -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;
+4 -3
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 NEW(t) ((t *) xmalloc((unsigned) sizeof(t)))
@@ -27,5 +28,5 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#define FREE(x) ((x) != 0 && (free ((char *) (x)), 0))
#endif
extern char *xmalloc();
extern char *xrealloc();
extern char *xmalloc PARAMS((register unsigned));
extern char *xrealloc PARAMS((register char *, register unsigned));
+504
View File
@@ -0,0 +1,504 @@
/* alloca.c -- allocate automatically reclaimed memory
(Mostly) portable public-domain implementation -- D A Gwyn
This implementation of the PWB library alloca function,
which is used to allocate space off the run-time stack so
that it is automatically reclaimed upon procedure exit,
was inspired by discussions with J. Q. Johnson of Cornell.
J.Otto Tennant <[email protected]> contributed the Cray support.
There are some preprocessor constants that can
be defined when compiling for your specific system, for
improved efficiency; however, the defaults should be okay.
The general concept of this implementation is to keep
track of all alloca-allocated blocks, and reclaim any
that are found to be deeper in the stack than the current
invocation. This heuristic does not reclaim storage as
soon as it becomes invalid, but it will do so eventually.
As a special case, alloca(0) reclaims storage without
allocating any. It is a good idea to use alloca(0) in
your main control loop, etc. to force garbage collection. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef emacs
#include "blockinput.h"
#endif
/* If compiling with GCC 2, this file's not needed. */
#if !defined (__GNUC__) || __GNUC__ < 2
/* If someone has defined alloca as a macro,
there must be some other way alloca is supposed to work. */
#ifndef alloca
#ifdef emacs
#ifdef static
/* actually, only want this if static is defined as ""
-- this is for usg, in which emacs must undefine static
in order to make unexec workable
*/
#ifndef STACK_DIRECTION
you
lose
-- must know STACK_DIRECTION at compile-time
#endif /* STACK_DIRECTION undefined */
#endif /* static */
#endif /* emacs */
/* If your stack is a linked list of frames, you have to
provide an "address metric" ADDRESS_FUNCTION macro. */
#if defined (CRAY) && defined (CRAY_STACKSEG_END)
long i00afunc ();
#define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg))
#else
#define ADDRESS_FUNCTION(arg) &(arg)
#endif
#if __STDC__
typedef void *pointer;
#else
typedef char *pointer;
#endif
#ifndef NULL
#define NULL 0
#endif
/* Different portions of Emacs need to call different versions of
malloc. The Emacs executable needs alloca to call xmalloc, because
ordinary malloc isn't protected from input signals. On the other
hand, the utilities in lib-src need alloca to call malloc; some of
them are very simple, and don't have an xmalloc routine.
Non-Emacs programs expect this to call use xmalloc.
Callers below should use malloc. */
#ifndef emacs
#define malloc xmalloc
#endif
extern pointer malloc ();
/* Define STACK_DIRECTION 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 */
#ifndef STACK_DIRECTION
#define STACK_DIRECTION 0 /* Direction unknown. */
#endif
#if STACK_DIRECTION != 0
#define STACK_DIR STACK_DIRECTION /* Known at compile-time. */
#else /* STACK_DIRECTION == 0; need run-time code. */
static int stack_dir; /* 1 or -1 once known. */
#define STACK_DIR stack_dir
static void
find_stack_direction ()
{
static char *addr = NULL; /* Address of first `dummy', once known. */
auto char dummy; /* To get stack address. */
if (addr == NULL)
{ /* Initial entry. */
addr = ADDRESS_FUNCTION (dummy);
find_stack_direction (); /* Recurse once. */
}
else
{
/* Second entry. */
if (ADDRESS_FUNCTION (dummy) > addr)
stack_dir = 1; /* Stack grew upward. */
else
stack_dir = -1; /* Stack grew downward. */
}
}
#endif /* STACK_DIRECTION == 0 */
/* An "alloca header" is used to:
(a) chain together all alloca'ed blocks;
(b) keep track of stack depth.
It is very important that sizeof(header) agree with malloc
alignment chunk size. The following default should work okay. */
#ifndef ALIGN_SIZE
#define ALIGN_SIZE sizeof(double)
#endif
typedef union hdr
{
char align[ALIGN_SIZE]; /* To force sizeof(header). */
struct
{
union hdr *next; /* For chaining headers. */
char *deep; /* For stack depth measure. */
} h;
} header;
static header *last_alloca_header = NULL; /* -> last alloca header. */
/* Return a pointer to at least SIZE bytes of storage,
which will be automatically reclaimed upon exit from
the procedure that called alloca. Originally, this space
was supposed to be taken from the current stack frame of the
caller, but that method cannot be made to work for some
implementations of C, for example under Gould's UTX/32. */
pointer
alloca (size)
unsigned size;
{
auto char probe; /* Probes stack depth: */
register char *depth = ADDRESS_FUNCTION (probe);
#if STACK_DIRECTION == 0
if (STACK_DIR == 0) /* Unknown growth direction. */
find_stack_direction ();
#endif
/* Reclaim garbage, defined as all alloca'd storage that
was allocated from deeper in the stack than currently. */
{
register header *hp; /* Traverses linked list. */
#ifdef emacs
BLOCK_INPUT;
#endif
for (hp = last_alloca_header; hp != NULL;)
if ((STACK_DIR > 0 && hp->h.deep > depth)
|| (STACK_DIR < 0 && hp->h.deep < depth))
{
register header *np = hp->h.next;
free ((pointer) hp); /* Collect garbage. */
hp = np; /* -> next header. */
}
else
break; /* Rest are not deeper. */
last_alloca_header = hp; /* -> last valid storage. */
#ifdef emacs
UNBLOCK_INPUT;
#endif
}
if (size == 0)
return NULL; /* No allocation required. */
/* Allocate combined header + user data storage. */
{
register pointer new = malloc (sizeof (header) + size);
/* Address of header. */
if (new == 0)
abort();
((header *) new)->h.next = last_alloca_header;
((header *) new)->h.deep = depth;
last_alloca_header = (header *) new;
/* User storage begins just after header. */
return (pointer) ((char *) new + sizeof (header));
}
}
#if defined (CRAY) && defined (CRAY_STACKSEG_END)
#ifdef DEBUG_I00AFUNC
#include <stdio.h>
#endif
#ifndef CRAY_STACK
#define CRAY_STACK
#ifndef CRAY2
/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */
struct stack_control_header
{
long shgrow:32; /* Number of times stack has grown. */
long shaseg:32; /* Size of increments to stack. */
long shhwm:32; /* High water mark of stack. */
long shsize:32; /* Current size of stack (all segments). */
};
/* The stack segment linkage control information occurs at
the high-address end of a stack segment. (The stack
grows from low addresses to high addresses.) The initial
part of the stack segment linkage control information is
0200 (octal) words. This provides for register storage
for the routine which overflows the stack. */
struct stack_segment_linkage
{
long ss[0200]; /* 0200 overflow words. */
long sssize:32; /* Number of words in this segment. */
long ssbase:32; /* Offset to stack base. */
long:32;
long sspseg:32; /* Offset to linkage control of previous
segment of stack. */
long:32;
long sstcpt:32; /* Pointer to task common address block. */
long sscsnm; /* Private control structure number for
microtasking. */
long ssusr1; /* Reserved for user. */
long ssusr2; /* Reserved for user. */
long sstpid; /* Process ID for pid based multi-tasking. */
long ssgvup; /* Pointer to multitasking thread giveup. */
long sscray[7]; /* Reserved for Cray Research. */
long ssa0;
long ssa1;
long ssa2;
long ssa3;
long ssa4;
long ssa5;
long ssa6;
long ssa7;
long sss0;
long sss1;
long sss2;
long sss3;
long sss4;
long sss5;
long sss6;
long sss7;
};
#else /* CRAY2 */
/* The following structure defines the vector of words
returned by the STKSTAT library routine. */
struct stk_stat
{
long now; /* Current total stack size. */
long maxc; /* Amount of contiguous space which would
be required to satisfy the maximum
stack demand to date. */
long high_water; /* Stack high-water mark. */
long overflows; /* Number of stack overflow ($STKOFEN) calls. */
long hits; /* Number of internal buffer hits. */
long extends; /* Number of block extensions. */
long stko_mallocs; /* Block allocations by $STKOFEN. */
long underflows; /* Number of stack underflow calls ($STKRETN). */
long stko_free; /* Number of deallocations by $STKRETN. */
long stkm_free; /* Number of deallocations by $STKMRET. */
long segments; /* Current number of stack segments. */
long maxs; /* Maximum number of stack segments so far. */
long pad_size; /* Stack pad size. */
long current_address; /* Current stack segment address. */
long current_size; /* Current stack segment size. This
number is actually corrupted by STKSTAT to
include the fifteen word trailer area. */
long initial_address; /* Address of initial segment. */
long initial_size; /* Size of initial segment. */
};
/* The following structure describes the data structure which trails
any stack segment. I think that the description in 'asdef' is
out of date. I only describe the parts that I am sure about. */
struct stk_trailer
{
long this_address; /* Address of this block. */
long this_size; /* Size of this block (does not include
this trailer). */
long unknown2;
long unknown3;
long link; /* Address of trailer block of previous
segment. */
long unknown5;
long unknown6;
long unknown7;
long unknown8;
long unknown9;
long unknown10;
long unknown11;
long unknown12;
long unknown13;
long unknown14;
};
#endif /* CRAY2 */
#endif /* not CRAY_STACK */
#ifdef CRAY2
/* Determine a "stack measure" for an arbitrary ADDRESS.
I doubt that "lint" will like this much. */
static long
i00afunc (long *address)
{
struct stk_stat status;
struct stk_trailer *trailer;
long *block, size;
long result = 0;
/* We want to iterate through all of the segments. The first
step is to get the stack status structure. We could do this
more quickly and more directly, perhaps, by referencing the
$LM00 common block, but I know that this works. */
STKSTAT (&status);
/* Set up the iteration. */
trailer = (struct stk_trailer *) (status.current_address
+ status.current_size
- 15);
/* There must be at least one stack segment. Therefore it is
a fatal error if "trailer" is null. */
if (trailer == 0)
abort ();
/* Discard segments that do not contain our argument address. */
while (trailer != 0)
{
block = (long *) trailer->this_address;
size = trailer->this_size;
if (block == 0 || size == 0)
abort ();
trailer = (struct stk_trailer *) trailer->link;
if ((block <= address) && (address < (block + size)))
break;
}
/* Set the result to the offset in this segment and add the sizes
of all predecessor segments. */
result = address - block;
if (trailer == 0)
{
return result;
}
do
{
if (trailer->this_size <= 0)
abort ();
result += trailer->this_size;
trailer = (struct stk_trailer *) trailer->link;
}
while (trailer != 0);
/* We are done. Note that if you present a bogus address (one
not in any segment), you will get a different number back, formed
from subtracting the address of the first block. This is probably
not what you want. */
return (result);
}
#else /* not CRAY2 */
/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP.
Determine the number of the cell within the stack,
given the address of the cell. The purpose of this
routine is to linearize, in some sense, stack addresses
for alloca. */
static long
i00afunc (long address)
{
long stkl = 0;
long size, pseg, this_segment, stack;
long result = 0;
struct stack_segment_linkage *ssptr;
/* Register B67 contains the address of the end of the
current stack segment. If you (as a subprogram) store
your registers on the stack and find that you are past
the contents of B67, you have overflowed the segment.
B67 also points to the stack segment linkage control
area, which is what we are really interested in. */
stkl = CRAY_STACKSEG_END ();
ssptr = (struct stack_segment_linkage *) stkl;
/* If one subtracts 'size' from the end of the segment,
one has the address of the first word of the segment.
If this is not the first segment, 'pseg' will be
nonzero. */
pseg = ssptr->sspseg;
size = ssptr->sssize;
this_segment = stkl - size;
/* It is possible that calling this routine itself caused
a stack overflow. Discard stack segments which do not
contain the target address. */
while (!(this_segment <= address && address <= stkl))
{
#ifdef DEBUG_I00AFUNC
fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl);
#endif
if (pseg == 0)
break;
stkl = stkl - pseg;
ssptr = (struct stack_segment_linkage *) stkl;
size = ssptr->sssize;
pseg = ssptr->sspseg;
this_segment = stkl - size;
}
result = address - this_segment;
/* If you subtract pseg from the current end of the stack,
you get the address of the previous stack segment's end.
This seems a little convoluted to me, but I'll bet you save
a cycle somewhere. */
while (pseg != 0)
{
#ifdef DEBUG_I00AFUNC
fprintf (stderr, "%011o %011o\n", pseg, size);
#endif
stkl = stkl - pseg;
ssptr = (struct stack_segment_linkage *) stkl;
size = ssptr->sssize;
pseg = ssptr->sspseg;
result += size;
}
return (result);
}
#endif /* not CRAY2 */
#endif /* CRAY */
#endif /* no alloca */
#endif /* not GCC version 2 */
+8 -7
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>
@@ -29,13 +30,15 @@ extern char *calloc ();
extern char *realloc ();
#endif
extern void done ();
char *xmalloc PARAMS((register unsigned));
char *xrealloc PARAMS((register char *, register unsigned));
extern void done PARAMS((int));
extern char *program_name;
char *
xmalloc (n)
register unsigned n;
xmalloc (register unsigned n)
{
register char *block;
@@ -53,9 +56,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)
+21
View File
@@ -0,0 +1,21 @@
!
! VMS BISON command definition file
!
DEFINE VERB BISON
IMAGE GNU_BISON:[000000]BISON
PARAMETER P1,Label=BISON$INFILE,Prompt="File"
value(required,type=$infile)
QUALIFIER VERBOSE,Label=BISON$VERBOSE
QUALIFIER DEFINES,Label=BISON$DEFINES
QUALIFIER FIXED_OUTFILES,Label=BISON$FIXED_OUTFILES
QUALIFIER NOPARSER,Label=BISON$NOPARSER
QUALIFIER RAW,LABEL=BISON$RAW
QUALIFIER TOKEN_TABLE,LABEL=BISON$TOKEN_TABLE
qualifier nolines,Label=BISON$NOLINES
qualifier debug,Label=BISON$DEBUG
qualifier output,value(type=$outfile),Label=BISON$OUTPUT
qualifier version,label=BISON$VERSION
qualifier yacc,label=BISON$YACC
qualifier file_prefix,value(type=$outfile),label=BISON$FILE_PREFIX
qualifier name_prefix,value(type=$outfile),LABEL=BISON$NAME_PREFIX
+2 -1
View File
@@ -17,7 +17,8 @@
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.
+2 -1
View File
@@ -17,7 +17,8 @@
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.
+83
View File
@@ -0,0 +1,83 @@
$! Set the def dir to proper place for use in batch. Works for interactive too.
$flnm = f$enviroment("PROCEDURE") ! get current procedure name
$set default 'f$parse(flnm,,,"DEVICE")''f$parse(flnm,,,"DIRECTORY")'
$!
$! This command procedure compiles and links BISON for VMS.
$! BISON has been tested with VAXC version 2.3 and VMS version 4.5
$! and on VMS 4.5 with GCC 1.12.
$!
$! Bj|rn Larsen [email protected]
$! With some contributions by Gabor Karsai,
$! KARSAIG1%[email protected]
$! All merged and cleaned by RMS.
$!
$! Adapted for both VAX-11 "C" and VMS/GCC compilation by
$! David L. Kashtan kashtan.iu.ai.sri.com
$!
$! First we try to sense which C compiler we have available. Sensing logic
$! borrowed from Emacs.
$!
$set noon !do not bomb if an error occurs.
$assign nla0: sys$output
$assign nla0: sys$error !so we do not get an error message about this.
$cc nla0:compiler_check.c
$if $status.eq.%x38090 then goto try_gcc
$ CC :== CC
$ cc_options:="/NOLIST/define=(""index=strchr"",""rindex=strrchr"")"
$ extra_linker_files:="VMSHLP,"
$goto have_compiler
$!
$try_gcc:
$gcc nla0:compiler_check.c
$if $status.eq.%x38090 then goto whoops
$ CC :== GCC
$ cc_options:="/DEBUG"
$ extra_linker_files:="GNU_CC:[000000]GCCLIB/LIB,"
$goto have_compiler
$!
$whoops:
$write sys$output "You must have a C compiler to build BISON. Sorry."
$deassign sys$output
$deassign sys$error
$exit %x38090
$!
$!
$have_compiler:
$deassign sys$output
$deassign sys$error
$set on
$if f$search("compiler_check.obj").nes."" then dele/nolog compiler_check.obj;
$write sys$output "Building BISON with the ''cc' compiler."
$!
$! Do the compilation (compiler type is all set up)
$!
$ Compile:
$ if "''p1'" .eqs. "LINK" then goto Link
$ 'CC' 'cc_options' files.c
$ 'CC' 'cc_options' LR0.C
$ 'CC' 'cc_options' ALLOCATE.C
$ 'CC' 'cc_options' CLOSURE.C
$ 'CC' 'cc_options' CONFLICTS.C
$ 'CC' 'cc_options' DERIVES.C
$ 'CC' 'cc_options' VMSGETARGS.C
$ 'CC' 'cc_options' GRAM.C
$ 'CC' 'cc_options' LALR.C
$ 'CC' 'cc_options' LEX.C
$ 'CC' 'cc_options' MAIN.C
$ 'CC' 'cc_options' NULLABLE.C
$ 'CC' 'cc_options' OUTPUT.C
$ 'CC' 'cc_options' PRINT.C
$ 'CC' 'cc_options' READER.C
$ 'CC' 'cc_options' REDUCE.C
$ 'CC' 'cc_options' SYMTAB.C
$ 'CC' 'cc_options' WARSHALL.C
$ 'CC' 'cc_options' VERSION.C
$ if "''CC'" .eqs. "CC" then macro vmshlp.mar
$ Link:
$ link/exec=bison main,LR0,allocate,closure,conflicts,derives,files,-
vmsgetargs,gram,lalr,lex,nullable,output,print,reader,reduce,symtab,warshall,-
version,'extra_linker_files'sys$library:vaxcrtl/lib
$!
$! Generate bison.hlp (for online help).
$!
$runoff bison.rnh
+17 -16
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.
@@ -58,10 +59,13 @@ Frees itemset, ruleset and internal data.
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,8 +305,8 @@ int n;
}
print_firsts()
void
print_firsts (void)
{
register int i;
register int j;
@@ -326,8 +327,8 @@ print_firsts()
}
print_fderives()
void
print_fderives (void)
{
register int i;
register int j;
+28 -33
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>
#include "system.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;
@@ -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,9 +293,7 @@ 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"),
@@ -302,7 +302,7 @@ char *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;
@@ -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;
@@ -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;
@@ -745,7 +740,7 @@ int state;
void
finalize_conflicts()
finalize_conflicts (void)
{
FREE(conflicts);
FREE(shiftset);
+8 -5
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.
@@ -29,11 +30,13 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#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,7 +95,8 @@ free_derives()
#ifdef DEBUG
print_derives()
void
print_derives (void)
{
register int i;
register short *sp;
@@ -115,4 +119,3 @@ print_derives()
}
#endif
+62 -40
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
@@ -39,7 +42,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#endif
#include <stdio.h>
#include "system.h"
#include "files.h"
#include "alloc.h"
#include "gram.h"
@@ -72,8 +74,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;
@@ -81,11 +88,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;
@@ -102,7 +106,8 @@ char *string2;
*cp++ = *cp1++;
cp1 = string2;
while (*cp++ = *cp1++) ;
while ((*cp++ = *cp1++))
;
return ostring;
}
@@ -111,10 +116,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;
@@ -142,6 +149,15 @@ openfiles()
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)
@@ -306,14 +322,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)
{
@@ -338,7 +356,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");
@@ -348,9 +366,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;
@@ -364,27 +380,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)
@@ -396,8 +418,8 @@ int k;
rewind(ftable);
while((c=getc(ftable)) != EOF)
putc(c,ftmp);
fclose(ftmp);
fclose(ftable);
tryclose(ftmp);
tryclose(ftable);
if (definesflag)
{
@@ -406,8 +428,8 @@ int k;
rewind(fdefines);
while((c=getc(fdefines)) != EOF)
putc(c,ftmp);
fclose(ftmp);
fclose(fdefines);
tryclose(ftmp);
tryclose(fdefines);
}
}
+3 -2
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 */
+10 -8
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,13 @@ char *spec_name_prefix; /* for -p. */
char *spec_file_prefix; /* for -b. */
extern int fixed_outfiles;/* for -y */
void usage PARAMS((FILE *));
void getargs PARAMS((int, char *[]));
extern char *program_name;
extern char *version_string;
extern void warns(); /* main.c */
extern void warns PARAMS((char *, char *)); /* main.c */
struct option longopts[] =
{
@@ -60,8 +64,7 @@ struct option longopts[] =
};
void
usage (stream)
FILE *stream;
usage (FILE *stream)
{
fprintf (stream, _("\
Usage: %s [-dhklntvyV] [-b file-prefix] [-o outfile] [-p name-prefix]\n\
@@ -69,14 +72,13 @@ Usage: %s [-dhklntvyV] [-b file-prefix] [-o outfile] [-p name-prefix]\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 [email protected]\n"),
program_name);
}
void
getargs(argc, argv)
int argc;
char *argv[];
getargs (int argc, char *argv[])
{
register int c;
+1052
View File
File diff suppressed because it is too large Load Diff
+133
View File
@@ -0,0 +1,133 @@
/* Declarations for getopt.
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 [email protected].
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
later version.
This program 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 this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA. */
#ifndef _GETOPT_H
#define _GETOPT_H 1
#ifdef __cplusplus
extern "C" {
#endif
/* For communication from `getopt' to the caller.
When `getopt' finds an option that takes an argument,
the argument value is returned here.
Also, when `ordering' is RETURN_IN_ORDER,
each non-option ARGV-element is returned here. */
extern char *optarg;
/* Index in ARGV of the next element to be scanned.
This is used for communication to and from the caller
and for communication between successive calls to `getopt'.
On entry to `getopt', zero means this is the first call; initialize.
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. */
extern int optind;
/* Callers store zero here to inhibit the error message `getopt' prints
for unrecognized options. */
extern int opterr;
/* Set to an option character which was unrecognized. */
extern int optopt;
/* Describe the long-named options requested by the application.
The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
of `struct option' terminated by an element containing a name which is
zero.
The field `has_arg' is:
no_argument (or 0) if the option does not take an argument,
required_argument (or 1) if the option requires an argument,
optional_argument (or 2) if the option takes an optional argument.
If the field `flag' is not NULL, it points to a variable that is set
to the value given in the field `val' when the option is found, but
left unchanged if the option is not found.
To have a long-named option do something other than set an `int' to
a compiled-in constant, such as set a value from `optarg', set the
option's `flag' field to zero and its `val' field to a nonzero
value (the equivalent single-letter option character, if there is
one). For long options that have a zero `flag' field, `getopt'
returns the contents of the `val' field. */
struct option
{
#if defined (__STDC__) && __STDC__
const char *name;
#else
char *name;
#endif
/* has_arg can't be an enum because some compilers complain about
type mismatches in all the code that assumes it is an int. */
int has_arg;
int *flag;
int val;
};
/* Names for the values of the `has_arg' field of `struct option'. */
#define no_argument 0
#define required_argument 1
#define optional_argument 2
#if defined (__STDC__) && __STDC__
#ifdef __GNU_LIBRARY__
/* Many other libraries have conflicting prototypes for getopt, with
differences in the consts, in stdlib.h. To avoid compilation
errors, only prototype getopt for the GNU C library. */
extern int getopt (int argc, char *const *argv, const char *shortopts);
#else /* not __GNU_LIBRARY__ */
extern int getopt ();
#endif /* __GNU_LIBRARY__ */
extern int getopt_long (int argc, char *const *argv, const char *shortopts,
const struct option *longopts, int *longind);
extern int getopt_long_only (int argc, char *const *argv,
const char *shortopts,
const struct option *longopts, int *longind);
/* Internal only. Users should not call this directly. */
extern int _getopt_internal (int argc, char *const *argv,
const char *shortopts,
const struct option *longopts, int *longind,
int long_only);
#else /* not __STDC__ */
extern int getopt ();
extern int getopt_long ();
extern int getopt_long_only ();
extern int _getopt_internal ();
#endif /* __STDC__ */
#ifdef __cplusplus
}
#endif
#endif /* getopt.h */
+190
View File
@@ -0,0 +1,190 @@
/* getopt_long and getopt_long_only entry points for GNU getopt.
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 [email protected].
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
later version.
This program 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 this program; 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
#include "getopt.h"
#if !defined __STDC__ || !__STDC__
/* This is a separate conditional since some stdc systems
reject `defined (const)'. */
#ifndef const
#define const
#endif
#endif
#include <stdio.h>
/* Comment out all this code if we are using the GNU C Library, and are not
actually compiling the library itself. This code is part of the GNU C
Library, but also included in many other GNU distributions. Compiling
and linking in this code is a waste when using the GNU C library
(especially if it is a shared library). Rather than having every GNU
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. */
#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>
#endif
#ifndef NULL
#define NULL 0
#endif
int
getopt_long (argc, argv, options, long_options, opt_index)
int argc;
char *const *argv;
const char *options;
const struct option *long_options;
int *opt_index;
{
return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
}
/* Like getopt_long, but '-' as well as '--' can indicate a long option.
If an option that starts with '-' (not '--') doesn't match a long option,
but does match a short option, it is parsed as a short option
instead. */
int
getopt_long_only (argc, argv, options, long_options, opt_index)
int argc;
char *const *argv;
const char *options;
const struct option *long_options;
int *opt_index;
{
return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
}
#endif /* Not ELIDE_CODE. */
#ifdef TEST
#include <stdio.h>
int
main (argc, argv)
int argc;
char **argv;
{
int c;
int digit_optind = 0;
while (1)
{
int this_option_optind = optind ? optind : 1;
int option_index = 0;
static struct option long_options[] =
{
{"add", 1, 0, 0},
{"append", 0, 0, 0},
{"delete", 1, 0, 0},
{"verbose", 0, 0, 0},
{"create", 0, 0, 0},
{"file", 1, 0, 0},
{0, 0, 0, 0}
};
c = getopt_long (argc, argv, "abc:d:0123456789",
long_options, &option_index);
if (c == -1)
break;
switch (c)
{
case 0:
printf ("option %s", long_options[option_index].name);
if (optarg)
printf (" with arg %s", optarg);
printf ("\n");
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
if (digit_optind != 0 && digit_optind != this_option_optind)
printf ("digits occur in two different argv-elements.\n");
digit_optind = this_option_optind;
printf ("option %c\n", c);
break;
case 'a':
printf ("option a\n");
break;
case 'b':
printf ("option b\n");
break;
case 'c':
printf ("option c with value `%s'\n", optarg);
break;
case 'd':
printf ("option d with value `%s'\n", optarg);
break;
case '?':
break;
default:
printf ("?? getopt returned character code 0%o ??\n", c);
}
}
if (optind < argc)
{
printf ("non-option ARGV-elements: ");
while (optind < argc)
printf ("%s ", argv[optind++]);
printf ("\n");
}
exit (0);
}
#endif /* TEST */
+3 -2
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)
{
}
+2 -1
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:
+39 -45
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;
@@ -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;
@@ -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;
+28 -26
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. */
/*
@@ -26,7 +27,6 @@ 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 */
@@ -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;
@@ -162,8 +169,7 @@ 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)
@@ -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;
@@ -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 = '\"';
@@ -293,8 +296,7 @@ literalchar(pp, pcode, term)
void
unlex(token)
int token;
unlex (int token)
{
unlexed = token;
unlexed_symval = symval;
@@ -302,7 +304,7 @@ unlex(token)
int
lex()
lex (void)
{
register int c;
char *p;
@@ -542,8 +544,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}
@@ -553,7 +555,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;
+2 -1
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
+2 -1
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
+86 -65
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,18 +33,37 @@ 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, "");
@@ -100,8 +121,7 @@ main(argc, argv)
either C itself, or the corresponding \DDD code. */
char *
printable_version(c)
int c;
printable_version (int c)
{
static char buf[10];
if (c < ' ' || c >= '\177')
@@ -118,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, _("%s: fatal error: %s\n"), program_name, s);
else
fprintf(stderr, _("%s:%d: fatal error: %s\n"), infile, lineno, s);
done(1);
fatal_banner ();
fputs (s, stderr);
fputc ('\n', stderr);
done (1);
}
@@ -146,97 +170,94 @@ 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, _("%s: %s\n"), program_name, s);
else
fprintf(stderr, _("%s:%d: %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, _("too many %s (max %d)"), s, MAXSHORT);
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, _("%s: internal error: %s\n"), program_name, s);
abort();
+6 -3
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.
@@ -30,9 +31,11 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
char *nullable;
void free_nullable PARAMS((void));
void set_nullable PARAMS((void));
void
set_nullable()
set_nullable (void)
{
register short *r;
register short *s1;
@@ -130,7 +133,7 @@ set_nullable()
void
free_nullable()
free_nullable (void)
{
FREE(nullable + ntokens);
}
+66 -69
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:
@@ -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;
@@ -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 */
+19 -20
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>
@@ -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,16 +80,14 @@ 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]);
}
void
print_state(state)
int state;
print_state (int state)
{
fprintf(foutput, _("\n\nstate %d\n\n"), state);
print_core(state);
@@ -95,8 +96,7 @@ int state;
void
print_core(state)
int state;
print_core (int state)
{
register int i;
register int k;
@@ -142,8 +142,7 @@ int state;
void
print_actions(state)
int state;
print_actions (int state)
{
register int i;
register int k;
@@ -243,7 +242,7 @@ int state;
else
void
print_grammar()
print_grammar (void)
{
int i, j;
short* rule;
+108 -86
View File
@@ -1,5 +1,5 @@
/* Input parser for bison
Copyright (C) 1984, 1986, 1989, 1992 Free Software Foundation, Inc.
Copyright (C) 1984, 1986, 1989, 1992, 1998 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
@@ -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. */
/* read in the grammar specification and record it in the format described in gram.h.
@@ -26,7 +27,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
The entry point is reader(). */
#include <stdio.h>
#include <ctype.h>
#include "system.h"
#include "files.h"
#include "alloc.h"
@@ -52,46 +52,30 @@ extern bucket *symval;
extern int numval;
extern int expected_conflicts;
extern char *token_buffer;
extern int maxtoken;
extern void init_lex();
extern void tabinit();
extern void output_headers();
extern void output_trailers();
extern void free_symtab();
extern void open_extra_files();
extern char *int_to_string();
extern void fatal();
extern void fatals();
extern void warn();
extern void warni();
extern void warns();
extern void warnss();
extern void warnsss();
extern void unlex();
extern void done();
extern void init_lex PARAMS((void));
extern char *grow_token_buffer PARAMS((char *));
extern void tabinit PARAMS((void));
extern void output_headers PARAMS((void));
extern void output_trailers PARAMS((void));
extern void free_symtab PARAMS((void));
extern void open_extra_files PARAMS((void));
extern char *int_to_string PARAMS((int));
extern char *printable_version PARAMS((int));
extern void fatal PARAMS((char *));
extern void fatals PARAMS((char *, char *));
extern void warn PARAMS((char *));
extern void warni PARAMS((char *, int));
extern void warns PARAMS((char *, char *));
extern void warnss PARAMS((char *, char *, char *));
extern void warnsss PARAMS((char *, char *, char *, char *));
extern void unlex PARAMS((int));
extern void done PARAMS((int));
extern int skip_white_space();
extern int parse_percent_token();
extern int lex();
void reader_output_yylsp();
void read_declarations();
void copy_definition();
void parse_token_decl();
void parse_start_decl();
void parse_type_decl();
void parse_assoc_decl();
void parse_union_decl();
void parse_expect_decl();
void parse_thong_decl();
void copy_action();
void readgram();
void record_rule_line();
void packsymbols();
void output_token_defines();
void packgram();
int read_signed_integer();
static int get_type();
extern int skip_white_space PARAMS((void));
extern int parse_percent_token PARAMS((void));
extern int lex PARAMS((void));
typedef
struct symbol_list
@@ -103,6 +87,31 @@ typedef
symbol_list;
void reader PARAMS((void));
void reader_output_yylsp PARAMS((FILE *));
void read_declarations PARAMS((void));
void copy_definition PARAMS((void));
void parse_token_decl PARAMS((int, int));
void parse_start_decl PARAMS((void));
void parse_type_decl PARAMS((void));
void parse_assoc_decl PARAMS((int));
void parse_union_decl PARAMS((void));
void parse_expect_decl PARAMS((void));
char *get_type_name PARAMS((int, symbol_list *));
void copy_guard PARAMS((symbol_list *, int));
void parse_thong_decl PARAMS((void));
void copy_action PARAMS((symbol_list *, int));
bucket *gensym PARAMS((void));
void readgram PARAMS((void));
void record_rule_line PARAMS((void));
void packsymbols PARAMS((void));
void output_token_defines PARAMS((FILE *));
void packgram PARAMS((void));
int read_signed_integer PARAMS((FILE *));
#if 0
static int get_type PARAMS((void));
#endif
int lineno;
symbol_list *grammar;
@@ -122,6 +131,7 @@ static int lastprec; /* incremented for each %left, %right or %nonassoc seen */
static int gensym_count; /* incremented for each generated symbol */
static bucket *errtoken;
static bucket *undeftoken;
/* Nonzero if any action or guard uses the @n construct. */
static int yylsp_needed;
@@ -130,8 +140,7 @@ extern char *version_string;
static void
skip_to_char(target)
int target;
skip_to_char (int target)
{
int c;
if (target == '\n')
@@ -148,7 +157,7 @@ skip_to_char(target)
void
reader()
reader (void)
{
start_flag = 0;
startval = NULL; /* start symbol not specified yet. */
@@ -190,7 +199,9 @@ reader()
errtoken->user_token_number = 256; /* Value specified by posix. */
/* construct a token that represents all undefined literal tokens. */
/* it is always token number 2. */
getsym("$undefined.")->class = STOKEN;
undeftoken = getsym("$undefined.");
undeftoken->class = STOKEN;
undeftoken->user_token_number = 2;
/* Read the declaration section. Copy %{ ... %} groups to ftable and fdefines file.
Also notice any %token, %left, etc. found there. */
if (noparserflag)
@@ -224,8 +235,7 @@ reader()
}
void
reader_output_yylsp(f)
FILE *f;
reader_output_yylsp (FILE *f)
{
if (yylsp_needed)
fprintf(f, LTYPESTR);
@@ -236,7 +246,7 @@ Handle any % declarations,
and copy the contents of any %{ ... %} groups to fattrs. */
void
read_declarations ()
read_declarations (void)
{
register int c;
register int tok;
@@ -333,7 +343,7 @@ read_declarations ()
The %{ has already been read. Return after reading the %}. */
void
copy_definition ()
copy_definition (void)
{
register int c;
register int match;
@@ -472,8 +482,7 @@ For %token, what_is is STOKEN and what_is_not is SNTERM.
For %nterm, the arguments are reversed. */
void
parse_token_decl (what_is, what_is_not)
int what_is, what_is_not;
parse_token_decl (int what_is, int what_is_not)
{
register int token = 0;
register char *typename = 0;
@@ -482,8 +491,13 @@ parse_token_decl (what_is, what_is_not)
for (;;)
{
if(ungetc(skip_white_space(), finput) == '%')
int tmp_char = ungetc (skip_white_space (), finput);
if (tmp_char == '%')
return;
if (tmp_char == EOF)
fatals ("Premature EOF after %s", token_buffer);
token = lex();
if (token == COMMA)
{
@@ -566,7 +580,7 @@ parse_token_decl (what_is, what_is_not)
*/
void
parse_thong_decl ()
parse_thong_decl (void)
{
register int token;
register struct bucket *symbol;
@@ -628,7 +642,7 @@ parse_thong_decl ()
/* parse what comes after %start */
void
parse_start_decl ()
parse_start_decl (void)
{
if (start_flag)
warn(_("multiple %start declarations"));
@@ -646,7 +660,7 @@ parse_start_decl ()
/* read in a %type declaration and record its information for get_type_name to access */
void
parse_type_decl ()
parse_type_decl (void)
{
register int k;
register char *name;
@@ -665,9 +679,12 @@ parse_type_decl ()
for (;;)
{
register int t;
int tmp_char = ungetc (skip_white_space (), finput);
if(ungetc(skip_white_space(), finput) == '%')
if (tmp_char == '%')
return;
if (tmp_char == EOF)
fatals ("Premature EOF after %s", token_buffer);
t = lex();
@@ -699,8 +716,7 @@ parse_type_decl ()
/* assoc is either LEFT_ASSOC, RIGHT_ASSOC or NON_ASSOC. */
void
parse_assoc_decl (assoc)
int assoc;
parse_assoc_decl (int assoc)
{
register int k;
register char *name = NULL;
@@ -711,9 +727,12 @@ int assoc;
for (;;)
{
register int t;
int tmp_char = ungetc (skip_white_space (), finput);
if(ungetc(skip_white_space(), finput) == '%')
if (tmp_char == '%')
return;
if (tmp_char == EOF)
fatals ("Premature EOF after %s", token_buffer);
t = lex();
@@ -780,7 +799,7 @@ int assoc;
definition of YYSTYPE, the type of elements of the parser value stack. */
void
parse_union_decl()
parse_union_decl (void)
{
register int c;
register int count;
@@ -894,7 +913,7 @@ parse_union_decl()
shift-reduce conflicts. */
void
parse_expect_decl()
parse_expect_decl (void)
{
register int c;
register int count;
@@ -925,9 +944,7 @@ parse_expect_decl()
/* Get the data type (alternative in the union) of the value for symbol n in rule rule. */
char *
get_type_name(n, rule)
int n;
symbol_list *rule;
get_type_name (int n, symbol_list *rule)
{
static char *msg = N_("invalid $ value");
@@ -966,9 +983,7 @@ which says where to find $0 with respect to the top of the stack,
for the simple parser in which the stack is not popped until after the guard is run. */
void
copy_guard(rule, stack_offset)
symbol_list *rule;
int stack_offset;
copy_guard (symbol_list *rule, int stack_offset)
{
register int c;
register int n;
@@ -1108,7 +1123,12 @@ int stack_offset;
register char *cp = token_buffer;
while ((c = getc(finput)) != '>' && c > 0)
*cp++ = c;
{
if (cp == token_buffer + maxtoken)
cp = grow_token_buffer(cp);
*cp++ = c;
}
*cp = 0;
type_name = token_buffer;
@@ -1199,9 +1219,7 @@ stack_offset is the number of values in the current rule so far,
which says where to find $0 with respect to the top of the stack. */
void
copy_action(rule, stack_offset)
symbol_list *rule;
int stack_offset;
copy_action (symbol_list *rule, int stack_offset)
{
register int c;
register int n;
@@ -1330,7 +1348,12 @@ int stack_offset;
register char *cp = token_buffer;
while ((c = getc(finput)) != '>' && c > 0)
*cp++ = c;
{
if (cp == token_buffer + maxtoken)
cp = grow_token_buffer(cp);
*cp++ = c;
}
*cp = 0;
type_name = token_buffer;
value_components_used = 1;
@@ -1415,7 +1438,7 @@ int stack_offset;
whose name cannot conflict with the user's names. */
bucket *
gensym()
gensym (void)
{
register bucket *sym;
@@ -1436,10 +1459,10 @@ All guards and actions are copied out to the appropriate files,
labelled by the rule number they apply to. */
void
readgram()
readgram (void)
{
register int t;
register bucket *lhs;
register bucket *lhs = NULL;
register symbol_list *p;
register symbol_list *p1;
register bucket *bp;
@@ -1728,24 +1751,25 @@ readgram()
void
record_rule_line ()
record_rule_line (void)
{
/* Record each rule's source line number in rline table. */
if (nrules >= rline_allocated)
{
rline_allocated = nrules * 2;
rline = (short *) xrealloc (rline,
rline_allocated * sizeof (short));
rline = (short *) xrealloc ((char *) rline,
rline_allocated * sizeof (short));
}
rline[nrules] = lineno;
}
#if 0
/* read in a %type declaration and record its information for get_type_name to access */
/* this is unused. it is only called from the #if 0 part of readgram */
static int
get_type()
get_type (void)
{
register int k;
register int t;
@@ -1788,14 +1812,14 @@ get_type()
}
}
}
#endif
/* assign symbol numbers, and write definition of token names into fdefines.
Set up vectors tags and sprec of names and precedences of symbols. */
void
packsymbols()
packsymbols (void)
{
register bucket *bp;
register int tokno = 1;
@@ -1942,8 +1966,7 @@ packsymbols()
The value is the user token number.
*/
void
output_token_defines(file)
FILE *file;
output_token_defines (FILE *file)
{
bucket *bp;
register char *cp, *symbol;
@@ -1987,7 +2010,7 @@ FILE *file;
/* convert the rules into the representation using rrhs, rlhs and ritems. */
void
packgram()
packgram (void)
{
register int itemno;
register int ruleno;
@@ -2048,8 +2071,7 @@ packgram()
/* Read a signed integer from STREAM and return its value. */
int
read_signed_integer (stream)
FILE *stream;
read_signed_integer (FILE *stream)
{
register int c = getc(stream);
register int sign = 1;
+27 -31
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. */
/*
@@ -39,6 +40,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
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,8 +90,7 @@ int n;
int
nbits (i)
unsigned i;
nbits (unsigned i)
{
int count = 0;
@@ -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;
@@ -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;
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;
}
@@ -197,7 +195,7 @@ BSet N;
/* Remember that rules are 1-origin, symbols are 0-origin. */
static void
useless_nonterminals ()
useless_nonterminals (void)
{
BSet Np, Ns;
int i, n;
@@ -254,7 +252,7 @@ useless_nonterminals ()
}
static void
inaccessable_symbols ()
inaccessable_symbols (void)
{
BSet Vp, Vs, Pp;
int i, n;
@@ -353,7 +351,7 @@ inaccessable_symbols ()
}
static void
reduce_grammar_tables ()
reduce_grammar_tables (void)
{
/* This is turned off because we would need to change the numbers
in the case statements in the actions file. */
@@ -482,7 +480,7 @@ reduce_grammar_tables ()
}
static void
print_results ()
print_results (void)
{
int i;
/* short j; JF unused */
@@ -532,7 +530,7 @@ print_results ()
}
void
dump_grammar ()
dump_grammar (void)
{
int i;
rule r;
@@ -569,10 +567,8 @@ dump_grammar ()
static void
print_notices ()
print_notices (void)
{
extern int fixed_outfiles;
if (fixed_outfiles && nuseless_productions)
fprintf(stderr, _("%d rules never reduced\n"), nuseless_productions);
+2 -1
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
+11 -11
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>
@@ -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 */
+3 -2
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 TABSIZE 1009
@@ -53,4 +54,4 @@ typedef
extern bucket **symtab;
extern bucket *firstsymbol;
extern bucket *getsym();
extern bucket *getsym PARAMS((char *));
+20 -4
View File
@@ -1,3 +1,10 @@
#ifndef BISON_SYSTEM_H
#define BISON_SYSTEM_H
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef MSDOS
#include <io.h>
#endif
@@ -12,6 +19,10 @@
#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
@@ -30,14 +41,18 @@
/* memory.h and strings.h conflict on some systems. */
#endif /* not STDC_HEADERS and not HAVE_STRING_H */
#if HAVE_LOCALE_H
#if defined(STDC_HEADERS) || defined(HAVE_CTYPE_H)
#include <ctype.h>
#endif
#ifdef HAVE_LOCALE_H
# include <locale.h>
#endif
#if !HAVE_SETLOCALE
#ifndef HAVE_SETLOCALE
# define setlocale(Category, Locale)
#endif
#if ENABLE_NLS
#ifdef ENABLE_NLS
# include <libintl.h>
# define _(Text) gettext (Text)
#else
@@ -48,5 +63,6 @@
#define N_(Text) Text
/* In the meantime, waiting for Automake. */
#define PACKAGE "bison"
#define LOCALEDIR "/usr/local/share/locale"
#endif /* BISON_SYSTEM_H */
+2 -1
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
+3 -1
View File
@@ -1 +1,3 @@
char *version_string = "GNU Bison version 1.25\n";
#include <config.h>
char *version_string = "GNU Bison version " VERSION "\n";
+2 -1
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>
+42
View File
@@ -0,0 +1,42 @@
;/* Macro help routines for the BISON/VMS program
; Gabor Karsai, Vanderbilt University
;
;BISON is distributed in the hope that it will be useful, but WITHOUT ANY
;WARRANTY. No author or distributor accepts responsibility to anyone
;for the consequences of using it or for whether it serves any
;particular purpose or works at all, unless he says so in writing.
;Refer to the BISON General Public License for full details.
;
;Everyone is granted permission to copy, modify and redistribute BISON,
;but only under the conditions described in the BISON General Public
;License. A copy of this license is supposed to have been given to you
;along with BISON so you can know your rights and responsibilities. It
;should be in a file named COPYING. Among other things, the copyright
;notice and this notice must be preserved on all copies.
;
; In other words, you are welcome to use, share and improve this program.
; You are forbidden to forbid anyone else to use, share and improve
; what you give them. Help stamp out software-hoarding! */
;
.psect vmshlp pic,usr,rel,ovr,shr,long,exe,nowrt
alloca::
.word 0
subl2 ^X4(ap),sp
movl ^X10(fp),r1
movq ^X8(fp),ap
bicl2 #03,sp
addl2 #^X1c,sp
movl sp,r0
jmp (r1)
bcopy::
.word ^X0e00
movl ^X04(ap),r11
movl ^X08(ap),r10
movl ^X0c(ap),r9
brb 1$
2$: movb (r10)+,(r11)+
1$: sobgeq r9,2$
ret
.end
+7 -8
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;
+1
View File
@@ -0,0 +1 @@
timestamp