mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-08-16 06:05:14 +00:00
Compare commits
11
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7347b2d316 | ||
|
|
58f5a6af40 | ||
|
|
888f3f0178 | ||
|
|
692be7fef0 | ||
|
|
4bfd57ce09 | ||
|
|
964db18ed6 | ||
|
|
598c90ee77 | ||
|
|
f7f37a7a0b | ||
|
|
671dc16a4a | ||
|
|
b3be630198 | ||
|
|
5aca537f83 |
+28
@@ -0,0 +1,28 @@
|
|||||||
|
*.cache
|
||||||
|
*.flc
|
||||||
|
*.patch *.log log patches applied
|
||||||
|
*.prj
|
||||||
|
.version
|
||||||
|
ABOUT-NLS
|
||||||
|
COPYING
|
||||||
|
INSTALL
|
||||||
|
Makefile
|
||||||
|
Makefile.in
|
||||||
|
_*
|
||||||
|
a.exe
|
||||||
|
a.out
|
||||||
|
aclocal.m4
|
||||||
|
b.out
|
||||||
|
bison-*
|
||||||
|
conf[0-9]*
|
||||||
|
confdefs*
|
||||||
|
config.log
|
||||||
|
config.status
|
||||||
|
configure
|
||||||
|
configure.lineno
|
||||||
|
conftest*
|
||||||
|
javacomp.sh
|
||||||
|
javaexec.sh
|
||||||
|
patches
|
||||||
|
releases
|
||||||
|
stamp-h*
|
||||||
@@ -1 +0,0 @@
|
|||||||
ChangeLog merge=merge-changelog
|
|
||||||
-34
@@ -1,34 +0,0 @@
|
|||||||
|
|
||||||
/*.cache
|
|
||||||
/*.flc
|
|
||||||
/*.prj
|
|
||||||
/*~
|
|
||||||
/.tarball-version
|
|
||||||
/.version
|
|
||||||
/ABOUT-NLS
|
|
||||||
/COPYING
|
|
||||||
/GNUmakefile
|
|
||||||
/INSTALL
|
|
||||||
/Makefile
|
|
||||||
/Makefile.in
|
|
||||||
/_*
|
|
||||||
/a.exe
|
|
||||||
/a.out
|
|
||||||
/aclocal.m4
|
|
||||||
/b.out
|
|
||||||
/bison-*
|
|
||||||
/conf[0-9]*
|
|
||||||
/confdefs*
|
|
||||||
/config.log
|
|
||||||
/config.status
|
|
||||||
/configure
|
|
||||||
/configure.lineno
|
|
||||||
/conftest*
|
|
||||||
/gnulib
|
|
||||||
/javacomp.sh
|
|
||||||
/javaexec.sh
|
|
||||||
/maint.mk
|
|
||||||
/patches
|
|
||||||
/releases
|
|
||||||
/stamp-h*
|
|
||||||
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
[submodule "gnulib"]
|
|
||||||
path = gnulib
|
|
||||||
url = git://git.savannah.gnu.org/gnulib.git
|
|
||||||
[submodule "submodules/autoconf"]
|
|
||||||
path = submodules/autoconf
|
|
||||||
url = git://git.sv.gnu.org/autoconf.git
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
2.3b
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
@VERSION@
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
COPYING
|
|
||||||
^bootstrap$
|
|
||||||
^doc/fdl\.texi$
|
|
||||||
^doc/gpl-3\.0\.texi$
|
|
||||||
^doc/yacc\.1\.in$
|
|
||||||
^src/parse-gram\.h$
|
|
||||||
+71
@@ -0,0 +1,71 @@
|
|||||||
|
# Having a separate GNUmakefile lets me `include' the dynamically
|
||||||
|
# generated rules created via Makefile.maint as well as Makefile.maint itself.
|
||||||
|
# This makefile is used only if you run GNU Make.
|
||||||
|
# It is necessary if you want to build targets usually of interest
|
||||||
|
# only to the maintainer.
|
||||||
|
|
||||||
|
# Copyright (C) 2001, 2003, 2006-2007, 2008 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
# Systems where /bin/sh is not the default shell need this. The $(shell)
|
||||||
|
# command below won't work with e.g. stock DOS/Windows shells.
|
||||||
|
ifeq ($(wildcard /bin/s[h]),/bin/sh)
|
||||||
|
SHELL = /bin/sh
|
||||||
|
else
|
||||||
|
# will be used only with the next shell-test line, then overwritten
|
||||||
|
# by a configured-in value
|
||||||
|
SHELL = sh
|
||||||
|
endif
|
||||||
|
|
||||||
|
have-Makefile := $(shell test -f Makefile && echo yes)
|
||||||
|
|
||||||
|
# If the user runs GNU make but has not yet run ./configure,
|
||||||
|
# give them a diagnostic.
|
||||||
|
ifeq ($(have-Makefile),yes)
|
||||||
|
|
||||||
|
# Make tar archive easier to reproduce.
|
||||||
|
export TAR_OPTIONS = --owner=0 --group=0 --numeric-owner
|
||||||
|
|
||||||
|
include Makefile
|
||||||
|
|
||||||
|
# Ensure that $(VERSION) is up to date for dist-related targets, but not
|
||||||
|
# for others: rerunning autoconf and recompiling everything isn't cheap.
|
||||||
|
ifeq (0,$(MAKELEVEL))
|
||||||
|
_is-dist-target = $(filter dist% alpha beta major,$(MAKECMDGOALS))
|
||||||
|
ifneq (,$(_is-dist-target))
|
||||||
|
_curr-ver := $(shell build-aux/git-version-gen .version)
|
||||||
|
ifneq ($(_curr-ver),$(VERSION))
|
||||||
|
$(info INFO: rerunning autoconf for new version string: $(_curr-ver))
|
||||||
|
dummy := $(shell rm -rf autom4te.cache; $(AUTOCONF))
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
include $(srcdir)/Makefile.cfg
|
||||||
|
include $(srcdir)/Makefile.maint
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
all:
|
||||||
|
@echo There seems to be no Makefile in this directory. 1>&2
|
||||||
|
@echo "You must run ./configure before running \`make'." 1>&2
|
||||||
|
@exit 1
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Tell version 3.79 and up of GNU make to not build goals in this
|
||||||
|
# directory in parallel. This is necessary in case someone tries to
|
||||||
|
# build multiple targets on one command line.
|
||||||
|
.NOTPARALLEL:
|
||||||
@@ -0,0 +1,136 @@
|
|||||||
|
-*- outline -*-
|
||||||
|
|
||||||
|
This file attempts to describe the rules to use when hacking Bison.
|
||||||
|
Don't put this file into the distribution. Don't mention it in the
|
||||||
|
ChangeLog.
|
||||||
|
|
||||||
|
Everything related to the development of Bison is on Savannah:
|
||||||
|
|
||||||
|
http://savannah.gnu.org/projects/bison/
|
||||||
|
|
||||||
|
|
||||||
|
* Administrivia
|
||||||
|
|
||||||
|
** If you incorporate a change from somebody on the net:
|
||||||
|
First, if it is a large change, you must make sure they have signed
|
||||||
|
the appropriate paperwork. Second, be sure to add their name and
|
||||||
|
email address to THANKS.
|
||||||
|
|
||||||
|
** If a change fixes a test, mention the test in the ChangeLog entry.
|
||||||
|
|
||||||
|
** Bug reports
|
||||||
|
If somebody reports a new bug, mention his name in the ChangeLog entry
|
||||||
|
and in the test case you write. Put him into THANKS.
|
||||||
|
|
||||||
|
The correct response to most actual bugs is to write a new test case
|
||||||
|
which demonstrates the bug. Then fix the bug, re-run the test suite,
|
||||||
|
and check everything in.
|
||||||
|
|
||||||
|
|
||||||
|
* Hacking
|
||||||
|
|
||||||
|
** Visible changes
|
||||||
|
Which include serious bug fixes, must be mentioned in NEWS.
|
||||||
|
|
||||||
|
** Translations
|
||||||
|
Only user visible strings are to be translated: error messages, bits
|
||||||
|
of the .output file etc. This excludes impossible error messages
|
||||||
|
(comparable to assert/abort), and all the --trace output which is
|
||||||
|
meant for the maintainers only.
|
||||||
|
|
||||||
|
|
||||||
|
* Test suite
|
||||||
|
|
||||||
|
** make check
|
||||||
|
Use liberally.
|
||||||
|
|
||||||
|
** Release checks
|
||||||
|
Try to run the test suite with more severe conditions before a
|
||||||
|
release:
|
||||||
|
|
||||||
|
- Configure the package with --enable-gcc-warnings, so that one checks
|
||||||
|
that 1. Bison compiles cleanly, 2. the parsers it produces compile
|
||||||
|
cleanly too.
|
||||||
|
|
||||||
|
- run `make maintainer-check' which:
|
||||||
|
- runs `valgrind -q bison' to run Bison under Valgrind.
|
||||||
|
- runs the parsers under Valgrind.
|
||||||
|
- runs the test suite with G++ as C compiler...
|
||||||
|
|
||||||
|
- Change tests/atlocal/CFLAGS to add your preferred options. For
|
||||||
|
instance, `-traditional' to check that the parsers are K&R. Note
|
||||||
|
that it does not make sense for glr.c, which should be ANSI,
|
||||||
|
but currently is actually GNU C, nor for lalr1.cc, which anyway is
|
||||||
|
not exercised yet in the test suite.
|
||||||
|
|
||||||
|
|
||||||
|
* Release Procedure
|
||||||
|
|
||||||
|
** Try to get the *.pot files to the Translation Project at least one week
|
||||||
|
before a stable release, to give them time to translate them.
|
||||||
|
|
||||||
|
** Tests
|
||||||
|
See above.
|
||||||
|
|
||||||
|
** Update the foreign files
|
||||||
|
Running `./bootstrap' in the top level should update them all for you.
|
||||||
|
This covers PO files too. Sometimes a PO file contains problems that
|
||||||
|
causes it to be rejected by recent Gettext releases; please report
|
||||||
|
these to the Translation Project.
|
||||||
|
|
||||||
|
** Update NEWS
|
||||||
|
The version number, *and* the date of the release (including for
|
||||||
|
betas).
|
||||||
|
|
||||||
|
** Update ChangeLog
|
||||||
|
Should have an entry similar to `Version 1.49b.'.
|
||||||
|
Check all this in once `make distcheck' passes.
|
||||||
|
|
||||||
|
** make alpha
|
||||||
|
Running `make alpha' is absolutely perfect for beta releases: it makes
|
||||||
|
the tarballs, the xdeltas, and prepares (in /tmp/) a proto
|
||||||
|
announcement. It is so neat, that that's what I use anyway for
|
||||||
|
genuine releases, but adjusting things by hand (e.g., the urls in the
|
||||||
|
announcement file, the ChangeLog which is not needed etc.).
|
||||||
|
|
||||||
|
If it fails, you're on your own...
|
||||||
|
|
||||||
|
It requires GNU Make.
|
||||||
|
|
||||||
|
** Upload
|
||||||
|
Put the tarballs/xdeltas where they should be. Or put it somewhere,
|
||||||
|
and send the URL to [email protected].
|
||||||
|
|
||||||
|
** Bump the version number
|
||||||
|
In configure.ac. Run `make', check this in.
|
||||||
|
|
||||||
|
** Announce
|
||||||
|
Complete/fix the announcement file, and send it at least to
|
||||||
|
[email protected] (if a real release, or a ``serious beta''),
|
||||||
|
[email protected], [email protected], [email protected],
|
||||||
|
and [email protected].
|
||||||
|
|
||||||
|
Send the same announcement on the comp.compilers newsgroup by sending
|
||||||
|
email to [email protected]. Do not make any Cc as the moderator will
|
||||||
|
throw away anything cross-posted or Cc'ed. It really needs to be a
|
||||||
|
separate message.
|
||||||
|
|
||||||
|
|
||||||
|
-----
|
||||||
|
|
||||||
|
Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This file is part of GNU Bison.
|
||||||
|
|
||||||
|
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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
|
||||||
+3
-27
@@ -1,6 +1,6 @@
|
|||||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
||||||
|
## Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software
|
||||||
## Copyright (C) 2001-2011 Free Software Foundation, Inc.
|
## Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -23,7 +23,7 @@ SUBDIRS = build-aux po runtime-po lib data src doc examples tests etc
|
|||||||
aclocaldir = @aclocaldir@
|
aclocaldir = @aclocaldir@
|
||||||
aclocal_DATA = m4/bison-i18n.m4
|
aclocal_DATA = m4/bison-i18n.m4
|
||||||
|
|
||||||
EXTRA_DIST = .prev-version .version cfg.mk \
|
EXTRA_DIST = GNUmakefile Makefile.cfg Makefile.maint \
|
||||||
OChangeLog PACKAGING \
|
OChangeLog PACKAGING \
|
||||||
djgpp/Makefile.maint djgpp/README.in djgpp/config.bat \
|
djgpp/Makefile.maint djgpp/README.in djgpp/config.bat \
|
||||||
djgpp/config.sed djgpp/config.site djgpp/config_h.sed \
|
djgpp/config.sed djgpp/config.site djgpp/config_h.sed \
|
||||||
@@ -42,27 +42,3 @@ maintainer-push-check:
|
|||||||
.PHONY: maintainer-xml-check
|
.PHONY: maintainer-xml-check
|
||||||
maintainer-xml-check:
|
maintainer-xml-check:
|
||||||
cd tests && $(MAKE) $(AM_MAKEFLAGS) $@
|
cd tests && $(MAKE) $(AM_MAKEFLAGS) $@
|
||||||
|
|
||||||
# See comments in build-aux/git-version-gen. However, we make .version depend
|
|
||||||
# on configure so that .version and VERSION/PACKAGE_VERSION stay in sync in the
|
|
||||||
# working copy (for example, when you run autoreconf && make). Allowing these
|
|
||||||
# to fall out of sync appears to have little potential to improve Bison build
|
|
||||||
# efficiency (even if we were to replace VERSION/PACKAGE_VERSION with .version
|
|
||||||
# everywhere possible). On the other hand, it could be harmful. For example,
|
|
||||||
# a developer might naively reference .version in a test case while the bison
|
|
||||||
# executable still compiles with VERSION, and so the test case might fail or
|
|
||||||
# pass incorrectly.
|
|
||||||
BUILT_SOURCES = $(top_srcdir)/.version
|
|
||||||
$(top_srcdir)/.version: configure
|
|
||||||
echo $(VERSION) > $@-t && mv $@-t $@
|
|
||||||
dist-hook:
|
|
||||||
echo $(VERSION) > $(distdir)/.tarball-version
|
|
||||||
|
|
||||||
.PHONY: update-b4-copyright update-package-copyright-year
|
|
||||||
update-b4-copyright:
|
|
||||||
find data -type f \
|
|
||||||
| grep -v -E '^data/bison.m4$$' \
|
|
||||||
| xargs $(build_aux)/$@
|
|
||||||
@echo 'warning: src/parse-gram.[hc] may need to be regenerated.'
|
|
||||||
update-package-copyright-year:
|
|
||||||
$(build_aux)/$@ configure.ac
|
|
||||||
|
|||||||
+5
-23
@@ -1,27 +1,19 @@
|
|||||||
# Customize maint.mk -*- makefile -*-
|
# Customize Makefile.maint. -*- makefile -*-
|
||||||
|
# Copyright (C) 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||||
# Copyright (C) 2008-2011 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# It's useful to run maintainer-*check* targets during development, but we
|
|
||||||
# don't want to wait on a recompile because of an update to $(VERSION). Thus,
|
|
||||||
# override the _is-dist-target from GNUmakefile so that maintainer-*check*
|
|
||||||
# targets are filtered out.
|
|
||||||
_is-dist-target = $(filter-out %clean maintainer-check% maintainer-%-check, \
|
|
||||||
$(filter maintainer-% dist% alpha beta major,$(MAKECMDGOALS)))
|
|
||||||
|
|
||||||
# Use alpha.gnu.org for alpha and beta releases.
|
# Use alpha.gnu.org for alpha and beta releases.
|
||||||
# Use ftp.gnu.org for major releases.
|
# Use ftp.gnu.org for major releases.
|
||||||
gnu_ftp_host-alpha = alpha.gnu.org
|
gnu_ftp_host-alpha = alpha.gnu.org
|
||||||
@@ -40,14 +32,4 @@ local-checks-to-skip = changelog-check
|
|||||||
|
|
||||||
# The local directory containing the checked-out copy of gnulib used in
|
# The local directory containing the checked-out copy of gnulib used in
|
||||||
# this release. Used solely to get a date for the "announcement" target.
|
# this release. Used solely to get a date for the "announcement" target.
|
||||||
gnulib_dir = $(srcdir)/gnulib
|
gnulib_dir = /gnulib
|
||||||
|
|
||||||
bootstrap-tools = autoconf,automake,flex,gettext,gnulib
|
|
||||||
|
|
||||||
announcement_Cc_ = \
|
|
||||||
[email protected], [email protected], [email protected], \
|
|
||||||
[email protected]
|
|
||||||
|
|
||||||
update-copyright: update-b4-copyright update-package-copyright-year
|
|
||||||
update-copyright-env = \
|
|
||||||
UPDATE_COPYRIGHT_FORCE=1 UPDATE_COPYRIGHT_USE_INTERVALS=1
|
|
||||||
+637
@@ -0,0 +1,637 @@
|
|||||||
|
# -*-Makefile-*-
|
||||||
|
# This Makefile fragment is shared between the coreutils,
|
||||||
|
# CPPI, Bison, and Autoconf.
|
||||||
|
|
||||||
|
## Copyright (C) 2001-2006 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
# This is reported not to work with make-3.79.1
|
||||||
|
# ME := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
|
||||||
|
ME := Makefile.maint
|
||||||
|
|
||||||
|
# Do not save the original name or timestamp in the .tar.gz file.
|
||||||
|
# Use --rsyncable if available.
|
||||||
|
gzip_rsyncable = \
|
||||||
|
(gzip --help|grep rsyncable) >/dev/null 2>&1 && echo --rsyncable
|
||||||
|
GZIP_ENV = "--no-name --best `$(gzip_rsyncable)`"
|
||||||
|
|
||||||
|
CVS = cvs
|
||||||
|
|
||||||
|
# cvsu is part of the cvsutils package: http://www.red-bean.com/cvsutils/
|
||||||
|
CVS_LIST = sh -c ' \
|
||||||
|
if test -x $(srcdir)/build-aux/cvsu; then \
|
||||||
|
$(srcdir)/build-aux/cvsu --find --types=AFGM $$*; \
|
||||||
|
else \
|
||||||
|
awk -F/ '\''{ \
|
||||||
|
if (!$$1 && $$3 !~ /^-/) { \
|
||||||
|
f=FILENAME; \
|
||||||
|
sub(/CVS\/Entries/, "", f); \
|
||||||
|
print f $$2; \
|
||||||
|
}}'\'' \
|
||||||
|
$$(find $${*-*} -name Entries -print) /dev/null; \
|
||||||
|
fi \
|
||||||
|
' dummy
|
||||||
|
|
||||||
|
CVS_LIST_EXCEPT = \
|
||||||
|
$(CVS_LIST) | if test -f .x-$@; then grep -vEf .x-$@; else grep -v ChangeLog; fi
|
||||||
|
|
||||||
|
ifeq ($(origin prev_version_file), undefined)
|
||||||
|
prev_version_file = .prev-version
|
||||||
|
endif
|
||||||
|
|
||||||
|
PREV_VERSION := $(shell cat $(prev_version_file))
|
||||||
|
VERSION_REGEXP = $(subst .,\.,$(VERSION))
|
||||||
|
|
||||||
|
tag-package = $(shell echo "$(PACKAGE)" | tr '[:lower:]' '[:upper:]')
|
||||||
|
tag-this-version = $(subst .,_,$(VERSION))
|
||||||
|
this-cvs-tag = $(tag-package)-$(tag-this-version)
|
||||||
|
my_distdir = $(PACKAGE)-$(VERSION)
|
||||||
|
|
||||||
|
# Old releases are stored here.
|
||||||
|
# Used for diffs and xdeltas.
|
||||||
|
release_archive_dir ?= ../release
|
||||||
|
|
||||||
|
# Prevent programs like 'sort' from considering distinct strings to be equal.
|
||||||
|
# Doing it here saves us from having to set LC_ALL elsewhere in this file.
|
||||||
|
export LC_ALL = C
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## --------------- ##
|
||||||
|
## Sanity checks. ##
|
||||||
|
## --------------- ##
|
||||||
|
|
||||||
|
# FIXME: add a check to prohibit definition in src/*.c of symbols defined
|
||||||
|
# in system.h. E.g. today I removed from tail.c a useless definition of
|
||||||
|
# ENOSYS. It was useless because system.h ensures it's defined.
|
||||||
|
|
||||||
|
# Checks that don't require cvs.
|
||||||
|
# Run `changelog-check' last, as previous test may reveal problems requiring
|
||||||
|
# new ChangeLog entries.
|
||||||
|
local-checks-available = \
|
||||||
|
po-check copyright-check writable-files m4-check author_mark_check \
|
||||||
|
changelog-check strftime-check $(syntax-check-rules) \
|
||||||
|
makefile_path_separator_check \
|
||||||
|
makefile-check
|
||||||
|
.PHONY: $(local-checks-available)
|
||||||
|
|
||||||
|
local-check = $(filter-out $(local-checks-to-skip), $(local-checks-available))
|
||||||
|
|
||||||
|
.PHONY: $(syntax-check-rules)
|
||||||
|
syntax-check-rules = \
|
||||||
|
sc_cast_of_argument_to_free \
|
||||||
|
sc_cast_of_x_alloc_return_value \
|
||||||
|
sc_cast_of_alloca_return_value \
|
||||||
|
sc_changelog \
|
||||||
|
sc_dd_max_sym_length \
|
||||||
|
sc_error_exit_success \
|
||||||
|
sc_file_system \
|
||||||
|
sc_no_if_have_config_h \
|
||||||
|
sc_obsolete_symbols \
|
||||||
|
sc_prohibit_atoi_atof \
|
||||||
|
sc_prohibit_jm_in_m4 \
|
||||||
|
sc_prohibit_assert_without_use \
|
||||||
|
sc_require_config_h \
|
||||||
|
sc_root_tests \
|
||||||
|
sc_space_tab \
|
||||||
|
sc_sun_os_names \
|
||||||
|
sc_system_h_headers \
|
||||||
|
sc_tight_scope \
|
||||||
|
sc_trailing_blank \
|
||||||
|
sc_two_space_separator_in_usage \
|
||||||
|
sc_unmarked_diagnostics \
|
||||||
|
sc_useless_cpp_parens
|
||||||
|
|
||||||
|
syntax-check: $(syntax-check-rules)
|
||||||
|
# @grep -nE '# *include <(limits|std(def|arg|bool))\.h>' \
|
||||||
|
# $$(find -type f -name '*.[chly]') && \
|
||||||
|
# { echo '$(ME): found conditional include' 1>&2; \
|
||||||
|
# exit 1; } || :
|
||||||
|
|
||||||
|
# grep -nE '^# *include <(string|stdlib)\.h>' \
|
||||||
|
# $(srcdir)/{lib,src}/*.[chy] && \
|
||||||
|
# { echo '$(ME): FIXME' 1>&2; \
|
||||||
|
# exit 1; } || :
|
||||||
|
# FIXME: don't allow `#include .strings\.h' anywhere
|
||||||
|
|
||||||
|
sc_cast_of_argument_to_free:
|
||||||
|
@grep -nE '\<free \(\(' $(srcdir)/{lib,src}/*.[chly] && \
|
||||||
|
{ echo '$(ME): don'\''t cast free argument' 1>&2; \
|
||||||
|
exit 1; } || :
|
||||||
|
|
||||||
|
sc_cast_of_x_alloc_return_value:
|
||||||
|
@grep -nE --exclude=$(srcdir)/lib/regex.c \
|
||||||
|
'\*\) *x(m|c|re)alloc\>' \
|
||||||
|
$(srcdir)/{lib,src}/*.[chy] && \
|
||||||
|
{ echo '$(ME): don'\''t cast x*alloc return value' 1>&2; \
|
||||||
|
exit 1; } || :
|
||||||
|
|
||||||
|
sc_cast_of_alloca_return_value:
|
||||||
|
@grep -nE '\*\) *alloca\>' \
|
||||||
|
$(srcdir)/src/*.[chy] && \
|
||||||
|
{ echo '$(ME): don'\''t cast alloca return value' 1>&2; \
|
||||||
|
exit 1; } || :
|
||||||
|
|
||||||
|
sc_space_tab:
|
||||||
|
@grep -n '[ ] ' $$($(CVS_LIST_EXCEPT)) && \
|
||||||
|
{ echo '$(ME): found SPACE-TAB sequence; remove the SPACE' \
|
||||||
|
1>&2; exit 1; } || :
|
||||||
|
|
||||||
|
# Don't use the old ato* functions in `real' code.
|
||||||
|
# They provide no error checking mechanism.
|
||||||
|
# Instead, use strto* functions.
|
||||||
|
sc_prohibit_atoi_atof:
|
||||||
|
@grep -nE '\<ato([filq]|ll)\>' $$($(CVS_LIST_EXCEPT)) && \
|
||||||
|
{ echo '$(ME): do not use ato''f, ato''i, ato''l, ato''ll, or ato''q' \
|
||||||
|
1>&2; exit 1; } || :
|
||||||
|
|
||||||
|
# Using EXIT_SUCCESS as the first argument to error is misleading,
|
||||||
|
# since when that parameter is 0, error does not exit. Use `0' instead.
|
||||||
|
sc_error_exit_success:
|
||||||
|
@grep -nF 'error (EXIT_SUCCESS,' \
|
||||||
|
$$(find -type f -name '*.[chly]') && \
|
||||||
|
{ echo '$(ME): found error (EXIT_SUCCESS' 1>&2; \
|
||||||
|
exit 1; } || :
|
||||||
|
|
||||||
|
sc_file_system:
|
||||||
|
@grep -ni 'file''system' $$($(CVS_LIST_EXCEPT)) && \
|
||||||
|
{ echo '$(ME): found use of "file''system";' \
|
||||||
|
'rewrite to use "file system"' 1>&2; \
|
||||||
|
exit 1; } || :
|
||||||
|
|
||||||
|
sc_no_if_have_config_h:
|
||||||
|
@grep -n '^# *if HAVE_CONFIG_H' $$($(CVS_LIST_EXCEPT)) && \
|
||||||
|
{ echo '$(ME): found use of #if HAVE_CONFIG_H; use #ifdef' \
|
||||||
|
1>&2; exit 1; } || :
|
||||||
|
|
||||||
|
# Nearly all .c files must include <config.h>.
|
||||||
|
sc_require_config_h:
|
||||||
|
@grep -L '^# *include <config\.h>' \
|
||||||
|
$$($(CVS_LIST_EXCEPT) | grep '\.c$$') \
|
||||||
|
| grep . && \
|
||||||
|
{ echo '$(ME): the above files do not include <config.h>' \
|
||||||
|
1>&2; exit 1; } || :
|
||||||
|
|
||||||
|
# Prohibit the inclusion of assert.h without an actual use of assert.
|
||||||
|
sc_prohibit_assert_without_use:
|
||||||
|
@files=$$(grep -l '# *include <assert\.h>' \
|
||||||
|
$$($(CVS_LIST_EXCEPT) | grep '\.c$$')) && \
|
||||||
|
grep -L '\<assert (' $$files \
|
||||||
|
| grep . && \
|
||||||
|
{ echo "$(ME): the above files include <assert.h> but don't use it" \
|
||||||
|
1>&2; exit 1; } || :
|
||||||
|
|
||||||
|
sc_obsolete_symbols:
|
||||||
|
@grep -nE '\<(HAVE''_FCNTL_H|O''_NDELAY)\>' \
|
||||||
|
$$($(CVS_LIST_EXCEPT)) && \
|
||||||
|
{ echo '$(ME): do not use HAVE''_FCNTL_H or O''_NDELAY' \
|
||||||
|
1>&2; exit 1; } || :
|
||||||
|
|
||||||
|
# FIXME: warn about definitions of EXIT_FAILURE, EXIT_SUCCESS, STREQ
|
||||||
|
|
||||||
|
# Each nonempty line must start with a year number, or a TAB.
|
||||||
|
sc_changelog:
|
||||||
|
@grep -n '^[^12 ]' $$(find . -maxdepth 2 -name ChangeLog) && \
|
||||||
|
{ echo '$(ME): found unexpected prefix in a ChangeLog' 1>&2; \
|
||||||
|
exit 1; } || :
|
||||||
|
|
||||||
|
# Ensure that dd's definition of LONGEST_SYMBOL stays in sync
|
||||||
|
# with the strings from the two affected variables.
|
||||||
|
dd_c = $(srcdir)/src/dd.c
|
||||||
|
sc_dd_max_sym_length:
|
||||||
|
ifneq ($(wildcard $(dd_c)),)
|
||||||
|
@len=$$( (sed -n '/conversions\[\] =$$/,/^};/p' $(dd_c);\
|
||||||
|
sed -n '/flags\[\] =$$/,/^};/p' $(dd_c) ) \
|
||||||
|
|sed -n '/"/s/^[^"]*"\([^"]*\)".*/\1/p' \
|
||||||
|
| wc --max-line-length); \
|
||||||
|
max=$$(sed -n '/^#define LONGEST_SYMBOL /s///p' $(dd_c) \
|
||||||
|
|tr -d '"' | wc --max-line-length); \
|
||||||
|
if test "$$len" = "$$max"; then :; else \
|
||||||
|
echo 'dd.c: LONGEST_SYMBOL is not longest' 1>&2; \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Many m4 macros names once began with `jm_'.
|
||||||
|
# On 2004-04-13, they were all changed to start with gl_ instead.
|
||||||
|
# Make sure that none are inadvertently reintroduced.
|
||||||
|
sc_prohibit_jm_in_m4:
|
||||||
|
@grep -nE 'jm_[A-Z]' \
|
||||||
|
$$($(CVS_LIST) $(srcdir)/m4 |grep '\.m4$$') && \
|
||||||
|
{ echo '$(ME): do not use jm_ in m4 macro names' \
|
||||||
|
1>&2; exit 1; } || :
|
||||||
|
|
||||||
|
sc_root_tests:
|
||||||
|
@t1=sc-root.expected; t2=sc-root.actual; \
|
||||||
|
grep -nl '^PRIV_CHECK_ARG=require-root' \
|
||||||
|
$$($(CVS_LIST) tests) |sed s,tests,., |sort > $$t1; \
|
||||||
|
sed -n 's, cd \([^ ]*\) .*MAKE..check TESTS=\(.*\),./\1/\2,p' \
|
||||||
|
$(srcdir)/tests/Makefile.am |sort > $$t2; \
|
||||||
|
diff -u $$t1 $$t2 || diff=1; \
|
||||||
|
rm -f $$t1 $$t2; \
|
||||||
|
test "$$diff" \
|
||||||
|
&& { echo 'tests/Makefile.am: missing check-root action'>&2; \
|
||||||
|
exit 1; } || :
|
||||||
|
|
||||||
|
# Create a list of regular expressions matching the names
|
||||||
|
# of files included from system.h. Exclude a couple.
|
||||||
|
.re-list:
|
||||||
|
@sed -n '/^# *include /s///p' $(srcdir)/src/system.h \
|
||||||
|
| grep -Ev 'sys/(param|file)\.h' \
|
||||||
|
| sed 's/ .*//;;s/^["<]/^# *include [<"]/;s/\.h[">]$$/\\.h[">]/' \
|
||||||
|
> $@-t
|
||||||
|
@mv $@-t $@
|
||||||
|
|
||||||
|
# Files in src/ should not include directly any of
|
||||||
|
# the headers already included via system.h.
|
||||||
|
sc_system_h_headers: .re-list
|
||||||
|
@if test -f $(srcdir)/src/system.h; then \
|
||||||
|
trap 'rc=$$?; rm -f .re-list; exit $$rc' 0 1 2 3 15; \
|
||||||
|
grep -nE -f .re-list \
|
||||||
|
$$($(CVS_LIST) src | \
|
||||||
|
grep -Ev '((copy|system)\.h|parse-gram\.c)$$') \
|
||||||
|
&& { echo '$(ME): the above are already included via system.h'\
|
||||||
|
1>&2; exit 1; } || :; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
sc_sun_os_names:
|
||||||
|
@grep -nEi \
|
||||||
|
'solaris[^[:alnum:]]*2\.(7|8|9|[1-9][0-9])|sunos[^[:alnum:]][6-9]' \
|
||||||
|
$$($(CVS_LIST_EXCEPT)) && \
|
||||||
|
{ echo '$(ME): found misuse of Sun OS version numbers' 1>&2; \
|
||||||
|
exit 1; } || :
|
||||||
|
|
||||||
|
sc_tight_scope:
|
||||||
|
$(MAKE) -C src $@
|
||||||
|
|
||||||
|
sc_trailing_blank:
|
||||||
|
@grep -n '[ ]$$' $$($(CVS_LIST_EXCEPT)) && \
|
||||||
|
{ echo '$(ME): found trailing blank(s)' \
|
||||||
|
1>&2; exit 1; } || :
|
||||||
|
|
||||||
|
sc_two_space_separator_in_usage:
|
||||||
|
@grep -n '^ *--[a-z][0-9A-Za-z-]* [^ ].*\\$$' \
|
||||||
|
$$($(CVS_LIST_EXCEPT)) && \
|
||||||
|
{ echo "$(ME): help2man requires at least two spaces between"; \
|
||||||
|
echo "$(ME): an option and its description"; \
|
||||||
|
1>&2; exit 1; } || :
|
||||||
|
|
||||||
|
# Look for diagnostics that aren't marked for translation.
|
||||||
|
# This won't find any for which error's format string is on a separate line.
|
||||||
|
sc_unmarked_diagnostics:
|
||||||
|
@grep -nE \
|
||||||
|
'\<error \([^"]*"[^"]*[a-z]{3}' $$($(CVS_LIST_EXCEPT)) \
|
||||||
|
| grep -v '_''(' && \
|
||||||
|
{ echo '$(ME): found unmarked diagnostic(s)' 1>&2; \
|
||||||
|
exit 1; } || :
|
||||||
|
|
||||||
|
# Avoid useless parentheses like those in this example:
|
||||||
|
# #if defined (SYMBOL) || defined (SYM2)
|
||||||
|
sc_useless_cpp_parens:
|
||||||
|
@grep -n '^# *if .*defined *(' $$($(CVS_LIST_EXCEPT)) && \
|
||||||
|
{ echo '$(ME): found useless parentheses in cpp directive' \
|
||||||
|
1>&2; exit 1; } || :
|
||||||
|
|
||||||
|
# Ensure that date's --help output stays in sync with the info
|
||||||
|
# documentation for GNU strftime. The only exception is %N,
|
||||||
|
# which date accepts but GNU strftime does not.
|
||||||
|
extract_char = sed 's/^[^%][^%]*%\(.\).*/\1/'
|
||||||
|
strftime-check:
|
||||||
|
if test -f $(srcdir)/src/date.c; then \
|
||||||
|
grep '^ %. ' $(srcdir)/src/date.c | sort \
|
||||||
|
| $(extract_char) > $@-src; \
|
||||||
|
{ echo N; \
|
||||||
|
info libc date calendar format | grep '^ `%.'\' \
|
||||||
|
| $(extract_char); } | sort > $@-info; \
|
||||||
|
diff -u $@-src $@-info || exit 1; \
|
||||||
|
rm -f $@-src $@-info; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Ensure that we use only the standard $(VAR) notation,
|
||||||
|
# not @...@ in Makefile.am, now that we can rely on automake
|
||||||
|
# to emit a definition for each substituted variable.
|
||||||
|
makefile-check:
|
||||||
|
grep -nE '@[A-Z_0-9]+@' `find . -name Makefile.am` \
|
||||||
|
&& { echo 'Makefile.maint: use $$(...), not @...@' 1>&2; exit 1; } || :
|
||||||
|
|
||||||
|
news-date-check: NEWS
|
||||||
|
today=`date +%Y-%m-%d`; \
|
||||||
|
if head NEWS | grep '^\*.* $(VERSION_REGEXP) ('$$today')' \
|
||||||
|
>/dev/null; then \
|
||||||
|
:; \
|
||||||
|
else \
|
||||||
|
echo "version or today's date is not in NEWS" 1>&2; \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
changelog-check:
|
||||||
|
if head ChangeLog | grep 'Version $(VERSION_REGEXP)\.$$' \
|
||||||
|
>/dev/null; then \
|
||||||
|
:; \
|
||||||
|
else \
|
||||||
|
echo "$(VERSION) not in ChangeLog" 1>&2; \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
m4-check:
|
||||||
|
@grep -n 'AC_DEFUN([^[]' m4/*.m4 \
|
||||||
|
&& { echo 'Makefile.maint: quote the first arg to AC_DEFUN' 1>&2; \
|
||||||
|
exit 1; } || :
|
||||||
|
|
||||||
|
# Verify that all source files using _() are listed in po/POTFILES.in.
|
||||||
|
# FIXME: don't hard-code file names below; use a more general mechanism.
|
||||||
|
po-check:
|
||||||
|
if test -f po/POTFILES.in; then \
|
||||||
|
grep -E -v '^(#|$$)' po/POTFILES.in \
|
||||||
|
| grep -v '^src/false\.c$$' | sort > $@-1; \
|
||||||
|
files=; \
|
||||||
|
for file in $$($(CVS_LIST_EXCEPT)) lib/*.[ch]; do \
|
||||||
|
case $$file in \
|
||||||
|
djgpp/* | man/*) continue;; \
|
||||||
|
esac; \
|
||||||
|
case $$file in \
|
||||||
|
*.[ch]) \
|
||||||
|
base=`expr " $$file" : ' \(.*\)\..'`; \
|
||||||
|
{ test -f $$base.l || test -f $$base.y; } && continue;; \
|
||||||
|
esac; \
|
||||||
|
files="$$files $$file"; \
|
||||||
|
done; \
|
||||||
|
grep -E -l '\bN?_\([^)"]*("|$$)' $$files | sort -u > $@-2; \
|
||||||
|
diff -u $@-1 $@-2 || exit 1; \
|
||||||
|
rm -f $@-1 $@-2; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
# In a definition of #define AUTHORS "... and ..." where the RHS contains
|
||||||
|
# the English word `and', the string must be marked with `N_ (...)' so that
|
||||||
|
# gettext recognizes it as a string requiring translation.
|
||||||
|
author_mark_check:
|
||||||
|
@grep -n '^# *define AUTHORS "[^"]* and ' src/*.c |grep -v ' N_ (' && \
|
||||||
|
{ echo 'Makefile.maint: enclose the above strings in N_ (...)' 1>&2; \
|
||||||
|
exit 1; } || :
|
||||||
|
|
||||||
|
# Sometimes it is useful to change the PATH environment variable
|
||||||
|
# in Makefiles. When doing so, it's better not to use the Unix-centric
|
||||||
|
# path separator of `:', but rather the automake-provided `@PATH_SEPARATOR@'.
|
||||||
|
# It'd be better to use `find -print0 ...|xargs -0 ...', but less portable,
|
||||||
|
# and there probably aren't many projects with so many Makefile.am files
|
||||||
|
# that we'd have to worry about limits on command line length.
|
||||||
|
msg = 'Makefile.maint: Do not use `:'\'' above; use @PATH_SEPARATOR@ instead'
|
||||||
|
makefile_path_separator_check:
|
||||||
|
@grep -n 'PATH=.*:' `find $(srcdir) -name Makefile.am` \
|
||||||
|
&& { echo $(msg) 1>&2; exit 1; } || :
|
||||||
|
|
||||||
|
# Check that `make alpha' will not fail at the end of the process.
|
||||||
|
writable-files:
|
||||||
|
if test -d $(release_archive_dir); then :; else \
|
||||||
|
mkdir $(release_archive_dir); \
|
||||||
|
fi
|
||||||
|
for file in $(distdir).tar.gz $(xd-delta) \
|
||||||
|
$(release_archive_dir)/$(distdir).tar.gz \
|
||||||
|
$(release_archive_dir)/$(xd-delta); do \
|
||||||
|
test -e $$file || continue; \
|
||||||
|
test -w $$file \
|
||||||
|
|| { echo ERROR: $$file is not writable; fail=1; }; \
|
||||||
|
done; \
|
||||||
|
test "$$fail" && exit 1 || :
|
||||||
|
|
||||||
|
v_etc_file = lib/version-etc.c
|
||||||
|
# Make sure that the copyright date in $(v_etc_file) is up to date.
|
||||||
|
copyright-check:
|
||||||
|
@if test -f $(v_etc_file); then \
|
||||||
|
grep 'enum { COPYRIGHT_YEAR = '$$(date +%Y)' };' $(v_etc_file) \
|
||||||
|
>/dev/null \
|
||||||
|
|| { echo 'out of date copyright in $(v_etc_file); update it' 1>&2; \
|
||||||
|
exit 1; }; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Sanity checks with the CVS repository.
|
||||||
|
cvs-tag-check:
|
||||||
|
echo $(this-cvs-tag); \
|
||||||
|
if $(CVS) -n log -h README | grep -e $(this-cvs-tag): >/dev/null; then \
|
||||||
|
echo "$(this-cvs-tag) as already been used; not tagging" 1>&2; \
|
||||||
|
exit 1; \
|
||||||
|
else :; fi
|
||||||
|
|
||||||
|
cvs-diff-check:
|
||||||
|
if $(CVS) diff >cvs-diffs; then \
|
||||||
|
rm cvs-diffs; \
|
||||||
|
else \
|
||||||
|
echo "Some files are locally modified:" 1>&2; \
|
||||||
|
cat cvs-diffs; \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
cvs-check: cvs-diff-check cvs-tag-check
|
||||||
|
|
||||||
|
maintainer-distcheck: changelog-check
|
||||||
|
$(MAKE) distcheck
|
||||||
|
$(MAKE) my-distcheck
|
||||||
|
|
||||||
|
|
||||||
|
# Tag before making distribution. Also, don't make a distribution if
|
||||||
|
# checks fail. Also, make sure the NEWS file is up-to-date.
|
||||||
|
# FIXME: use dist-hook/my-dist like distcheck-hook/my-distcheck.
|
||||||
|
cvs-dist: $(local-check) cvs-check maintainer-distcheck
|
||||||
|
$(CVS) update po
|
||||||
|
$(CVS) tag -c $(this-cvs-tag)
|
||||||
|
$(MAKE) dist
|
||||||
|
|
||||||
|
# Use this to make sure we don't run these programs when building
|
||||||
|
# from a virgin tgz file, below.
|
||||||
|
null_AM_MAKEFLAGS = \
|
||||||
|
ACLOCAL=false \
|
||||||
|
AUTOCONF=false \
|
||||||
|
AUTOMAKE=false \
|
||||||
|
AUTOHEADER=false \
|
||||||
|
MAKEINFO=false
|
||||||
|
|
||||||
|
# Detect format-string/arg-list mismatches that would normally be obscured
|
||||||
|
# by the use of _(). The --disable-nls effectively defines away that macro,
|
||||||
|
# and building with CFLAGS='-Wformat -Werror' causes any format warning to be
|
||||||
|
# treated as a failure. Also, check for shadowing problems with -Wshadow.
|
||||||
|
# These CFLAGS are pretty strict. If you build this target, you probably
|
||||||
|
# have to have a recent version of gcc and glibc headers.
|
||||||
|
TMPDIR ?= /tmp
|
||||||
|
t=$(TMPDIR)/$(PACKAGE)/test
|
||||||
|
my-distcheck: $(local-check) $(release_archive_dir)/$(prev-tgz)
|
||||||
|
-rm -rf $(t)
|
||||||
|
mkdir -p $(t)
|
||||||
|
GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz
|
||||||
|
cd $(t)/$(distdir) \
|
||||||
|
&& ./configure --disable-nls \
|
||||||
|
&& $(MAKE) CFLAGS='-Werror -Wall -Wformat -Wshadow' \
|
||||||
|
AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \
|
||||||
|
&& $(MAKE) dvi \
|
||||||
|
&& $(MAKE) check \
|
||||||
|
&& $(MAKE) distclean
|
||||||
|
(cd $(t) && mv $(distdir) $(distdir).old \
|
||||||
|
&& $(AMTAR) -zxf - ) < $(distdir).tar.gz
|
||||||
|
diff -ur $(t)/$(distdir).old $(t)/$(distdir)
|
||||||
|
-rm -rf $(t)
|
||||||
|
@echo "========================"; \
|
||||||
|
echo "$(distdir).tar.gz is ready for distribution"; \
|
||||||
|
echo "========================"
|
||||||
|
|
||||||
|
WGET = wget
|
||||||
|
WGETFLAGS = -C off
|
||||||
|
|
||||||
|
rel-check:
|
||||||
|
tarz=/tmp/rel-check-tarz-$$$$; \
|
||||||
|
md5_tmp=/tmp/rel-check-md5-$$$$; \
|
||||||
|
set -e; \
|
||||||
|
trap 'status=$$?; rm -f $$tarz $$md5_tmp; exit $$status' 0 1 2 3 15; \
|
||||||
|
$(WGET) $(WGETFLAGS) -q --output-document=$$tarz $(url); \
|
||||||
|
echo "$(md5) -" > $$md5_tmp; \
|
||||||
|
md5sum -c $$md5_tmp < $$tarz
|
||||||
|
|
||||||
|
prev-tgz = $(PACKAGE)-$(PREV_VERSION).tar.gz
|
||||||
|
xd-delta = $(PACKAGE)-$(PREV_VERSION)-$(VERSION).xdelta
|
||||||
|
|
||||||
|
rel-files = $(xd-delta) $(DIST_ARCHIVES)
|
||||||
|
announcement: NEWS ChangeLog $(rel-files)
|
||||||
|
@./announce-gen \
|
||||||
|
--release-type=$(RELEASE_TYPE) \
|
||||||
|
--package=$(PACKAGE) \
|
||||||
|
--prev=$(PREV_VERSION) \
|
||||||
|
--curr=$(VERSION) \
|
||||||
|
--release-archive-directory=$(release_archive_dir) \
|
||||||
|
--gpg-key-id=$(gpg_key_ID) \
|
||||||
|
--news=NEWS \
|
||||||
|
$(addprefix --url-dir=, $(url_dir_list)) \
|
||||||
|
|
||||||
|
|
||||||
|
## ---------------- ##
|
||||||
|
## Updating files. ##
|
||||||
|
## ---------------- ##
|
||||||
|
|
||||||
|
ftp-gnu = ftp://ftp.gnu.org/gnu
|
||||||
|
www-gnu = http://www.gnu.org
|
||||||
|
|
||||||
|
# Use mv, if you don't have/want move-if-change.
|
||||||
|
move_if_change ?= move-if-change
|
||||||
|
|
||||||
|
|
||||||
|
# --------------------- #
|
||||||
|
# Updating everything. #
|
||||||
|
# --------------------- #
|
||||||
|
|
||||||
|
.PHONY: update
|
||||||
|
local_updates ?= wget-update cvs-update po-update
|
||||||
|
update: $(local_updates)
|
||||||
|
|
||||||
|
|
||||||
|
# ------------------- #
|
||||||
|
# Updating PO files. #
|
||||||
|
# ------------------- #
|
||||||
|
|
||||||
|
po_repo = http://www.iro.umontreal.ca/contrib/po/maint/$(PACKAGE)
|
||||||
|
.PHONY: do-po-update po-update
|
||||||
|
do-po-update:
|
||||||
|
tmppo=/tmp/$(PACKAGE)-$(VERSION)-po &&\
|
||||||
|
rm -rf $$tmppo && \
|
||||||
|
mkdir $$tmppo && \
|
||||||
|
(cd $$tmppo && \
|
||||||
|
$(WGET) $(WGETFLAGS) -r -l1 -nd --no-parent -A '*.po' $(po_repo)) &&\
|
||||||
|
cp $$tmppo/*.po po
|
||||||
|
cd po && $(MAKE) update-po
|
||||||
|
$(MAKE) po-check
|
||||||
|
|
||||||
|
po-update:
|
||||||
|
if test -d "po"; then \
|
||||||
|
$(MAKE) do-po-update; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
# -------------------------- #
|
||||||
|
# Updating GNU build tools. #
|
||||||
|
# -------------------------- #
|
||||||
|
|
||||||
|
# The following pseudo table associates a local directory and a URL
|
||||||
|
# with each of the files that belongs to some other package and is
|
||||||
|
# regularly updated from the specified URL.
|
||||||
|
wget_files ?= \
|
||||||
|
$(srcdir)/build-aux/config.guess \
|
||||||
|
$(srcdir)/build-aux/config.sub \
|
||||||
|
$(srcdir)/build-aux/texinfo.tex \
|
||||||
|
$(srcdir)/src/ansi2knr.c
|
||||||
|
|
||||||
|
get-targets = $(patsubst %, get-%, $(wget_files))
|
||||||
|
|
||||||
|
config.guess-url_prefix = $(ftp-gnu)/build-aux/
|
||||||
|
config.sub-url_prefix = $(ftp-gnu)/build-aux/
|
||||||
|
|
||||||
|
ansi2knr.c-url_prefix = ftp://ftp.cs.wisc.edu/ghost/
|
||||||
|
|
||||||
|
texinfo.tex-url_prefix = $(ftp-gnu)/texinfo/
|
||||||
|
|
||||||
|
standards.texi-url_prefix = $(www-gnu)/prep/
|
||||||
|
make-stds.texi-url_prefix = $(standards.texi-url_prefix)
|
||||||
|
|
||||||
|
target = $(patsubst get-%, %, $@)
|
||||||
|
url = $($(notdir $(target))-url_prefix)$(notdir $(target))
|
||||||
|
|
||||||
|
.PHONY: $(get-targets)
|
||||||
|
$(get-targets):
|
||||||
|
$(WGET) $(WGETFLAGS) $(url) -O $(target).t \
|
||||||
|
&& $(move_if_change) $(target).t $(target)
|
||||||
|
|
||||||
|
cvs_files ?= \
|
||||||
|
$(srcdir)/build-aux/depcomp \
|
||||||
|
$(srcdir)/build-aux/install-sh \
|
||||||
|
$(srcdir)/build-aux/missing \
|
||||||
|
$(srcdir)/build-aux/mkinstalldirs \
|
||||||
|
$(srcdir)/src/ansi2knr.c
|
||||||
|
automake_repo=:pserver:anoncvs:[email protected]:/cvs/automake
|
||||||
|
.PHONY: wget-update
|
||||||
|
wget-update: $(get-targets)
|
||||||
|
|
||||||
|
.PHONY: cvs-update
|
||||||
|
cvs-update:
|
||||||
|
fail=; \
|
||||||
|
for f in $(cvs_files); do \
|
||||||
|
test -f $$f || { echo "*** skipping $$f" 1>&2; continue; }; \
|
||||||
|
cvs diff $$f > /dev/null \
|
||||||
|
|| { echo "*** $$f is locally modified; skipping it" 1>&2; \
|
||||||
|
fail=yes; continue; }; \
|
||||||
|
file=$$(basename $$f); \
|
||||||
|
echo checking out $$file...; \
|
||||||
|
$(CVS) -d $(automake_repo) co -p automake/lib/$$file> $$f.t \
|
||||||
|
&& $(move_if_change) $$f.t $$f; \
|
||||||
|
done; \
|
||||||
|
test "$$fail" && exit 1
|
||||||
|
|
||||||
|
emit_upload_commands:
|
||||||
|
@echo =====================================
|
||||||
|
@echo =====================================
|
||||||
|
@echo "$(srcdir)/gnupload $(GNUPLOADFLAGS) \\"
|
||||||
|
@echo " --to $(gnu_rel_host):coreutils \\"
|
||||||
|
@echo " $(rel-files)"
|
||||||
|
@echo '# send the /tmp/announcement e-mail'
|
||||||
|
@echo =====================================
|
||||||
|
@echo =====================================
|
||||||
|
|
||||||
|
$(xd-delta): $(release_archive_dir)/$(prev-tgz) $(distdir).tar.gz
|
||||||
|
xdelta delta -9 $^ $@ || :
|
||||||
|
|
||||||
|
.PHONY: alpha beta major
|
||||||
|
alpha beta major: news-date-check $(local-check)
|
||||||
|
$(MAKE) cvs-dist
|
||||||
|
$(MAKE) $(xd-delta)
|
||||||
|
$(MAKE) -s announcement RELEASE_TYPE=$@ > /tmp/announce-$(my_distdir)
|
||||||
|
ln $(rel-files) $(release_archive_dir)
|
||||||
|
chmod a-w $(rel-files)
|
||||||
|
$(MAKE) -s emit_upload_commands RELEASE_TYPE=$@
|
||||||
|
echo $(VERSION) > $(prev_version_file)
|
||||||
|
$(CVS) ci -m. $(prev_version_file)
|
||||||
@@ -36,7 +36,7 @@ to the bison package.
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2002, 2005, 2009-2011 Free Software Foundation, Inc.
|
Copyright (C) 2002, 2005 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
|||||||
@@ -1,51 +1,27 @@
|
|||||||
This package contains the GNU Bison parser generator.
|
This directory contains the Bison parser generator.
|
||||||
|
|
||||||
* Installation
|
See the file INSTALL for generic compilation and installation instructions.
|
||||||
** Build
|
See the file doc/FAQ for frequently asked questions.
|
||||||
See the file INSTALL for generic compilation and installation
|
|
||||||
instructions.
|
|
||||||
|
|
||||||
Bison requires GNU m4 1.4.6 or later. See:
|
Bison requires GNU m4 1.4.3 or later. See:
|
||||||
|
|
||||||
ftp://ftp.gnu.org/gnu/m4/m4-1.4.6.tar.gz
|
ftp://ftp.gnu.org/gnu/m4/m4-1.4.3.tar.gz
|
||||||
|
|
||||||
** Internationalization
|
Bison can work with pre-1.4.3 distributions of GNU m4 if they are
|
||||||
Bison supports two catalogues: one for Bison itself (i.e., for the
|
sufficiently patched, but if you encounter a bug with an older
|
||||||
maintainer-side parser generation), and one for the generated parsers
|
distribution and report a bug we will probably suggest that you
|
||||||
(i.e., for the user-side parser execution). The requirements between
|
upgrade to 1.4.3 as the first step in trying to fix it.
|
||||||
both differ: bison needs ngettext, the generated parsers do not. To
|
|
||||||
simplify the build system, neither are installed if ngettext is not
|
|
||||||
supported, even if generated parsers could have been localized. See
|
|
||||||
http://lists.gnu.org/archive/html/bug-bison/2009-08/msg00006.html for
|
|
||||||
more details.
|
|
||||||
|
|
||||||
* Questions
|
|
||||||
See the section FAQ in the documentation (doc/bison.info) for
|
|
||||||
frequently asked questions. The documentation is also available in
|
|
||||||
PDF and HTML, provided you have a recent version of Texinfo installed:
|
|
||||||
run "make pdf" or "make html".
|
|
||||||
|
|
||||||
If you have questions about using Bison and the documentation does
|
|
||||||
not answer them, please send mail to <[email protected]>.
|
|
||||||
|
|
||||||
* Bug reports
|
|
||||||
Please send bug reports to <[email protected]>. Please include the
|
Please send bug reports to <[email protected]>. Please include the
|
||||||
version number from `bison --version', and a complete, self-contained
|
version number from `bison --version', and a complete, self-contained
|
||||||
test case in each bug report.
|
test case in each bug report.
|
||||||
|
|
||||||
* Copyright statements
|
If you have questions about using Bison and the documentation does
|
||||||
For any copyright year range specified as YYYY-ZZZZ in this package,
|
not answer them, please send mail to <[email protected]>.
|
||||||
note that the range specifies every single year in that closed interval.
|
|
||||||
|
|
||||||
|
|
||||||
Local Variables:
|
|
||||||
mode: outline
|
|
||||||
End:
|
|
||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 1992, 1998-1999, 2003-2005, 2008-2011 Free Software
|
Copyright (C) 1992, 1998, 1999, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||||
Foundation, Inc.
|
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -12,7 +12,7 @@ the problems you encounter.
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2002, 2004, 2009-2011 Free Software Foundation, Inc.
|
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GNU Bison.
|
This file is part of GNU Bison.
|
||||||
|
|
||||||
|
|||||||
+10
-331
@@ -1,58 +1,9 @@
|
|||||||
-*- outline -*-
|
-*- outline -*-
|
||||||
|
|
||||||
This file attempts to describe the rules to use when hacking Bison.
|
|
||||||
Don't put this file into the distribution.
|
|
||||||
|
|
||||||
Everything related to the development of Bison is on Savannah:
|
|
||||||
|
|
||||||
http://savannah.gnu.org/projects/bison/
|
|
||||||
|
|
||||||
|
|
||||||
* Administrivia
|
|
||||||
|
|
||||||
** If you incorporate a change from somebody on the net:
|
|
||||||
First, if it is a large change, you must make sure they have signed
|
|
||||||
the appropriate paperwork. Second, be sure to add their name and
|
|
||||||
email address to THANKS.
|
|
||||||
|
|
||||||
** If a change fixes a test, mention the test in the ChangeLog entry.
|
|
||||||
|
|
||||||
** Bug reports
|
|
||||||
If somebody reports a new bug, mention his name in the ChangeLog entry
|
|
||||||
and in the test case you write. Put him into THANKS.
|
|
||||||
|
|
||||||
The correct response to most actual bugs is to write a new test case
|
|
||||||
which demonstrates the bug. Then fix the bug, re-run the test suite,
|
|
||||||
and check everything in.
|
|
||||||
|
|
||||||
** You may find it useful to install the git-merge-changelog merge driver:
|
|
||||||
|
|
||||||
http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=blob;f=lib/git-merge-changelog.c
|
|
||||||
|
|
||||||
When following the generic installation instructions there, keep in mind that
|
|
||||||
your clone of Bison's git repository already contains appropriate
|
|
||||||
.gitattributes files, and running Bison's bootstrap script will make the
|
|
||||||
necessary changes to .git/config.
|
|
||||||
|
|
||||||
|
|
||||||
* Hacking
|
|
||||||
|
|
||||||
** Visible changes
|
|
||||||
Which include serious bug fixes, must be mentioned in NEWS.
|
|
||||||
|
|
||||||
** Translations
|
|
||||||
Only user visible strings are to be translated: error messages, bits
|
|
||||||
of the .output file etc. This excludes impossible error messages
|
|
||||||
(comparable to assert/abort), and all the --trace output which is
|
|
||||||
meant for the maintainers only.
|
|
||||||
|
|
||||||
|
|
||||||
* Working from the repository
|
|
||||||
|
|
||||||
These notes intend to help people working on the checked-out sources.
|
These notes intend to help people working on the checked-out sources.
|
||||||
These requirements do not apply when building from a distribution tarball.
|
These requirements do not apply when building from a distribution tarball.
|
||||||
|
|
||||||
** Requirements
|
* Requirements
|
||||||
|
|
||||||
We've opted to keep only the highest-level sources in the repository.
|
We've opted to keep only the highest-level sources in the repository.
|
||||||
This eases our maintenance burden, (fewer merges etc.), but imposes more
|
This eases our maintenance burden, (fewer merges etc.), but imposes more
|
||||||
@@ -82,310 +33,38 @@ Only building the initial full source tree will be a bit painful.
|
|||||||
Later, after synchronizing from the repository a plain `make' should
|
Later, after synchronizing from the repository a plain `make' should
|
||||||
be sufficient.
|
be sufficient.
|
||||||
|
|
||||||
** First checkout
|
* First checkout
|
||||||
|
|
||||||
Obviously, if you are reading these notes, you did manage to check out
|
Obviously, if you are reading these notes, you did manage to check out
|
||||||
this package from the repository. For the record, you will find all the
|
this package from the repository. For the record, you will find all the
|
||||||
relevant information on:
|
relevant information on:
|
||||||
|
|
||||||
http://savannah.gnu.org/git/?group=bison
|
http://savannah.gnu.org/cvs/?group_id=56
|
||||||
|
|
||||||
Bison uses Git submodules: subscriptions to other Git repositories.
|
|
||||||
In particular it uses gnulib, the GNU portability library. To ask Git
|
|
||||||
to perform the first checkout of the submodules, run
|
|
||||||
|
|
||||||
$ git submodule update --init
|
|
||||||
|
|
||||||
Git submodule support is weak before versions 1.6 and later, you
|
|
||||||
should probably upgrade Git if your version is older.
|
|
||||||
|
|
||||||
The next step is to get other files needed to build, which are
|
The next step is to get other files needed to build, which are
|
||||||
extracted from other source packages:
|
extracted from other source packages:
|
||||||
|
|
||||||
$ ./bootstrap
|
$ ./bootstrap
|
||||||
|
|
||||||
And there you are! Just
|
And there you are! Just
|
||||||
|
|
||||||
$ ./configure
|
$ ./configure
|
||||||
$ make
|
$ make
|
||||||
$ make check
|
$ make check
|
||||||
|
|
||||||
At this point, there should be no difference between your local copy,
|
At this point, there should be no difference between your local copy,
|
||||||
and the master copy:
|
and the master copy:
|
||||||
|
|
||||||
$ git diff
|
$ cvs diff
|
||||||
|
|
||||||
should output no difference.
|
should output no difference.
|
||||||
|
|
||||||
Enjoy!
|
Enjoy!
|
||||||
|
|
||||||
** Updating
|
|
||||||
|
|
||||||
The use of submodules make things somewhat different because git does
|
|
||||||
not support recursive operations: submodules must be taken care of
|
|
||||||
explicitly by the user.
|
|
||||||
|
|
||||||
*** Updating Bison
|
|
||||||
|
|
||||||
If you pull a newer version of a branch, say via `git pull', you might
|
|
||||||
import requests for updated submodules. A simple `git diff' will
|
|
||||||
reveal if the current version of the submodule (i.e., the actual
|
|
||||||
contents of the gnulib directory) and the current request from the
|
|
||||||
subscriber (i.e., the reference of the version of gnulib that the
|
|
||||||
Bison reporitory requests) differ. To upgrade the submodules (i.e.,
|
|
||||||
to check out the version that is actually requested by the subscriber,
|
|
||||||
run `git submodule update'.
|
|
||||||
|
|
||||||
$ git pull
|
|
||||||
$ git submodule update
|
|
||||||
|
|
||||||
*** Updating a submodule
|
|
||||||
To update a submodule, say gnulib, do as follows:
|
|
||||||
|
|
||||||
Get the most recent version of the master branch from git.
|
|
||||||
|
|
||||||
$ cd gnulib
|
|
||||||
$ git fetch
|
|
||||||
$ git checkout -b master --track origin/master
|
|
||||||
|
|
||||||
Make sure Bison can live with that version of gnulib.
|
|
||||||
|
|
||||||
$ cd ..
|
|
||||||
$ ./bootstrap
|
|
||||||
$ make distcheck
|
|
||||||
|
|
||||||
Register your changes.
|
|
||||||
|
|
||||||
$ git checkin ...
|
|
||||||
|
|
||||||
For a suggestion of what gnulib commit might be stable enough for a
|
|
||||||
formal release, see the ChangeLog in the latest gnulib snapshot at:
|
|
||||||
|
|
||||||
http://erislabs.net/ianb/projects/gnulib/
|
|
||||||
|
|
||||||
The autoconf files we use are currently:
|
|
||||||
|
|
||||||
m4/m4.m4
|
|
||||||
lib/m4sugar/m4sugar.m4
|
|
||||||
lib/m4sugar/foreach.m4
|
|
||||||
|
|
||||||
These files don't change very often in autoconf, so it should be
|
|
||||||
relatively straight-forward to examine the differences in order to
|
|
||||||
decide whether to update.
|
|
||||||
|
|
||||||
* Test suite
|
|
||||||
|
|
||||||
** make check
|
|
||||||
Use liberally.
|
|
||||||
|
|
||||||
** Release checks
|
|
||||||
Try to run the test suite with more severe conditions before a
|
|
||||||
release:
|
|
||||||
|
|
||||||
- Configure the package with --enable-gcc-warnings, so that one checks
|
|
||||||
that 1. Bison compiles cleanly, 2. the parsers it produces compile
|
|
||||||
cleanly too.
|
|
||||||
|
|
||||||
- Build with -DGNULIB_POSIXCHECK. It suggests gnulib modules that can
|
|
||||||
fix portability issues.
|
|
||||||
|
|
||||||
- run `make maintainer-check' which:
|
|
||||||
- runs `valgrind -q bison' to run Bison under Valgrind.
|
|
||||||
- runs the parsers under Valgrind.
|
|
||||||
- runs the test suite with G++ as C compiler...
|
|
||||||
|
|
||||||
- run `make maintainer-push-check', which runs `make maintainer-check'
|
|
||||||
while activating the push implementation and its pull interface wrappers
|
|
||||||
in many test cases that were originally written to exercise only the
|
|
||||||
pull implementation. This makes certain the push implementation can
|
|
||||||
perform every task the pull implementation can.
|
|
||||||
|
|
||||||
- run `make maintainer-xml-check', which runs `make maintainer-check'
|
|
||||||
while checking Bison's XML automaton report for every working grammar
|
|
||||||
passed to Bison in the test suite. The check just diffs the output of
|
|
||||||
Bison's included XSLT style sheets with the output of --report=all and
|
|
||||||
--graph.
|
|
||||||
|
|
||||||
- Change tests/atlocal/CFLAGS to add your preferred options. For
|
|
||||||
instance, `-traditional' to check that the parsers are K&R. Note
|
|
||||||
that it does not make sense for glr.c, which should be ANSI,
|
|
||||||
but currently is actually GNU C, nor for lalr1.cc.
|
|
||||||
|
|
||||||
|
|
||||||
* Release Procedure
|
|
||||||
|
|
||||||
** Update the submodules. See above.
|
|
||||||
|
|
||||||
** Try to get the *.pot files to the Translation Project at least one
|
|
||||||
week before a stable release, to give them time to translate them.
|
|
||||||
Before generating the *.pot files, make sure that po/POTFILES.in and
|
|
||||||
runtime-po/POTFILES.in list all files with translatable strings.
|
|
||||||
This helps: grep -l '\<_(' *
|
|
||||||
|
|
||||||
** Tests
|
|
||||||
See above.
|
|
||||||
|
|
||||||
** Update the foreign files
|
|
||||||
Running `./bootstrap' in the top level should update them all for you.
|
|
||||||
This covers PO files too. Sometimes a PO file contains problems that
|
|
||||||
causes it to be rejected by recent Gettext releases; please report
|
|
||||||
these to the Translation Project.
|
|
||||||
|
|
||||||
** Update README
|
|
||||||
Make sure the information in README is current. Most notably, make sure
|
|
||||||
it recommends a version of GNU M4 that is compatible with the latest
|
|
||||||
Bison sources.
|
|
||||||
|
|
||||||
** Check copyright years.
|
|
||||||
We update years in copyright statements throughout Bison once at the
|
|
||||||
start of every year by running `make update-copyright'. However, before
|
|
||||||
a release, it's good to verify that it's actually been run. Besides the
|
|
||||||
copyright statement for each Bison file, check the copyright statements
|
|
||||||
that the skeletons insert into generated parsers, and check all
|
|
||||||
occurrences of PACKAGE_COPYRIGHT_YEAR in configure.ac.
|
|
||||||
|
|
||||||
** Update NEWS
|
|
||||||
The version number, *and* the date of the release (including for
|
|
||||||
betas).
|
|
||||||
|
|
||||||
** Update ChangeLog
|
|
||||||
Should have an entry similar to `Version 1.49b.'.
|
|
||||||
|
|
||||||
** Tag the release
|
|
||||||
Before Bison will build with the right version number, you must tag the release
|
|
||||||
in git. Do this after all other changes. The command is similar to:
|
|
||||||
|
|
||||||
git tag -a v2.3b
|
|
||||||
|
|
||||||
The log message can be simply:
|
|
||||||
|
|
||||||
Bison 2.3b
|
|
||||||
|
|
||||||
** Push
|
|
||||||
Once `make distcheck' passes, push your changes and the tag.
|
|
||||||
`git push' without arguments will not push the tag.
|
|
||||||
|
|
||||||
** make alpha
|
|
||||||
FIXME: `make alpha' is not maintained and is broken. These
|
|
||||||
instructions need to be replaced or removed.
|
|
||||||
|
|
||||||
Running `make alpha' is absolutely perfect for beta releases: it makes
|
|
||||||
the tarballs, the xdeltas, and prepares (in /tmp/) a proto
|
|
||||||
announcement. It is so neat, that that's what I use anyway for
|
|
||||||
genuine releases, but adjusting things by hand (e.g., the urls in the
|
|
||||||
announcement file, the ChangeLog which is not needed etc.).
|
|
||||||
|
|
||||||
If it fails, you're on your own...
|
|
||||||
|
|
||||||
It requires GNU Make.
|
|
||||||
|
|
||||||
** Upload
|
|
||||||
The generic GNU upload procedure is at:
|
|
||||||
|
|
||||||
http://www.gnu.org/prep/maintain/maintain.html#Automated-FTP-Uploads
|
|
||||||
|
|
||||||
Follow the instructions there to register your information so you're permitted
|
|
||||||
to upload. Make sure your public key has been uploaded at least to
|
|
||||||
keys.gnupg.net. You can upload it with:
|
|
||||||
|
|
||||||
gpg --keyserver keys.gnupg.net --send-keys F125BDF3
|
|
||||||
|
|
||||||
where F125BDF3 should be replaced with your key ID.
|
|
||||||
|
|
||||||
Here's a brief reminder of how to roll the tarballs and upload them:
|
|
||||||
|
|
||||||
*** make distcheck
|
|
||||||
*** gpg -b bison-2.3b.tar.gz
|
|
||||||
*** In a file named `bison-2.3b.tar.gz.directive', type:
|
|
||||||
|
|
||||||
version: 1.1
|
|
||||||
directory: bison
|
|
||||||
filename: bison-2.3b.tar.gz
|
|
||||||
|
|
||||||
*** gpg --clearsign bison-2.3b.tar.gz.directive
|
|
||||||
*** ftp ftp-upload.gnu.org # Log in as anonymous.
|
|
||||||
*** cd /incoming/alpha # cd /incoming/ftp for full release.
|
|
||||||
*** put bison-2.3b.tar.gz # This can take a while.
|
|
||||||
*** put bison-2.3b.tar.gz.sig
|
|
||||||
*** put bison-2.3b.tar.gz.directive.asc
|
|
||||||
*** Repeat all these steps for bison-2.3b.tar.bz2.
|
|
||||||
|
|
||||||
** Update Bison manual on www.gnu.org.
|
|
||||||
|
|
||||||
*** You need a non-anonymous checkout of the web pages directory.
|
|
||||||
|
|
||||||
$ cvs -d [email protected]:/web/bison checkout bison
|
|
||||||
|
|
||||||
*** Get familiar with the instructions for web page maintainers.
|
|
||||||
http://www.gnu.org/server/standards/readme_index.html
|
|
||||||
http://www.gnu.org/server/standards/README.software.html
|
|
||||||
especially the note about symlinks.
|
|
||||||
|
|
||||||
*** Build the web pages.
|
|
||||||
Assuming BISON_CHECKOUT refers to a checkout of the Bison dir, and
|
|
||||||
BISON_WWW_CHECKOUT refers to the web directory created above, do:
|
|
||||||
|
|
||||||
$ cd $BISON_CHECKOUT/doc
|
|
||||||
$ make stamp-vti
|
|
||||||
$ ../build-aux/gendocs.sh -o "$BISON_WWW_CHECKOUT/manual" \
|
|
||||||
bison "Bison - GNU parser generator"
|
|
||||||
$ cd $BISON_WWW_CHECKOUT
|
|
||||||
|
|
||||||
Verify that the result looks sane.
|
|
||||||
|
|
||||||
*** Commit the modified and the new files.
|
|
||||||
|
|
||||||
*** Remove old files.
|
|
||||||
Find the files which have not been overwritten (because they belonged to
|
|
||||||
sections that have been removed or renamed):
|
|
||||||
|
|
||||||
$ cd manual/html_node
|
|
||||||
$ ls -lt
|
|
||||||
|
|
||||||
Remove these files and commit their removal to CVS. For each of these
|
|
||||||
files, add a line to the file .symlinks. This will ensure that
|
|
||||||
hyperlinks to the removed files will redirect to the entire manual; this
|
|
||||||
is better than a 404 error.
|
|
||||||
|
|
||||||
There is a problem with 'index.html' being written twice (once for POSIX
|
|
||||||
function 'index', once for the table of contents); you can ignore this
|
|
||||||
issue.
|
|
||||||
|
|
||||||
** Announce
|
|
||||||
To generate a template announcement file:
|
|
||||||
|
|
||||||
make RELEASE_TYPE=alpha gpg_key_ID=F125BDF3 announcement
|
|
||||||
|
|
||||||
where alpha can be replaced by beta or stable and F125BDF3 should be
|
|
||||||
replaced with your key ID.
|
|
||||||
|
|
||||||
Complete/fix the announcement file. The generated list of recipients
|
|
||||||
([email protected], [email protected], [email protected],
|
|
||||||
[email protected], and [email protected]) is
|
|
||||||
appropriate for a stable release or a ``serious beta''. For any other
|
|
||||||
release, drop at least [email protected]. For an example of how to fill
|
|
||||||
out the rest of the template, search the mailing list archives for the
|
|
||||||
most recent release announcement.
|
|
||||||
|
|
||||||
For a stable release, send the same announcement on the comp.compilers
|
|
||||||
newsgroup by sending email to [email protected]. Do not make any Cc as
|
|
||||||
the moderator will throw away anything cross-posted or Cc'ed. It really
|
|
||||||
needs to be a separate message.
|
|
||||||
|
|
||||||
** Bump the version number
|
|
||||||
In configure.ac. Run `make'. So that developers don't accidentally add new
|
|
||||||
items to the old NEWS entry, create a new empty NEWS entry something like:
|
|
||||||
|
|
||||||
Changes in version ?.? (????-??-??):
|
|
||||||
|
|
||||||
Push these changes.
|
|
||||||
|
|
||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2002-2005, 2007-2011 Free Software Foundation, Inc.
|
Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software
|
||||||
|
Foundation, Inc.
|
||||||
This file is part of GNU Bison.
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -8,15 +8,12 @@ Alexander Belopolsky [email protected]
|
|||||||
Alexandre Duret-Lutz [email protected]
|
Alexandre Duret-Lutz [email protected]
|
||||||
Andreas Schwab [email protected]
|
Andreas Schwab [email protected]
|
||||||
Andrew Suffield [email protected]
|
Andrew Suffield [email protected]
|
||||||
Angelo Borsotti [email protected]
|
|
||||||
Anthony Heading [email protected]
|
Anthony Heading [email protected]
|
||||||
Arnold Robbins [email protected]
|
Arnold Robbins [email protected]
|
||||||
Art Haas [email protected]
|
Art Haas [email protected]
|
||||||
Baron Schwartz [email protected]
|
Baron Schwartz [email protected]
|
||||||
Benoit Perrot [email protected]
|
Benoit Perrot [email protected]
|
||||||
Bernd Kiefer [email protected]
|
|
||||||
Bert Deknuydt [email protected]
|
Bert Deknuydt [email protected]
|
||||||
Bill Allombert [email protected]
|
|
||||||
Bob Rossi [email protected]
|
Bob Rossi [email protected]
|
||||||
Brandon Lucia [email protected]
|
Brandon Lucia [email protected]
|
||||||
Bruce Lilly [email protected]
|
Bruce Lilly [email protected]
|
||||||
@@ -25,14 +22,10 @@ Charles-Henri de Boysson [email protected]
|
|||||||
Christian Burger [email protected]
|
Christian Burger [email protected]
|
||||||
Cris Bailiff [email protected]
|
Cris Bailiff [email protected]
|
||||||
Cris van Pelt [email protected]
|
Cris van Pelt [email protected]
|
||||||
Csaba Raduly [email protected]
|
|
||||||
Dagobert Michelsen [email protected]
|
|
||||||
Daniel Hagerty [email protected]
|
Daniel Hagerty [email protected]
|
||||||
David J. MacKenzie [email protected]
|
David J. MacKenzie [email protected]
|
||||||
Derek M. Jones [email protected]
|
Derek M. Jones [email protected]
|
||||||
Di-an Jan [email protected]
|
|
||||||
Dick Streefland [email protected]
|
Dick Streefland [email protected]
|
||||||
Didier Godefroy [email protected]
|
|
||||||
Enrico Scholz [email protected]
|
Enrico Scholz [email protected]
|
||||||
Eric Blake [email protected]
|
Eric Blake [email protected]
|
||||||
Evgeny Stambulchik [email protected]
|
Evgeny Stambulchik [email protected]
|
||||||
@@ -40,33 +33,25 @@ Fabrice Bauzac [email protected]
|
|||||||
Florian Krohm [email protected]
|
Florian Krohm [email protected]
|
||||||
Frank Heckenbach [email protected]
|
Frank Heckenbach [email protected]
|
||||||
Frans Englich [email protected]
|
Frans Englich [email protected]
|
||||||
Georg Sauthoff [email protected]
|
|
||||||
George Neuner [email protected]
|
|
||||||
Goran Uddeborg [email protected]
|
|
||||||
Guido Trentalancia [email protected]
|
Guido Trentalancia [email protected]
|
||||||
H. Merijn Brand [email protected]
|
H. Merijn Brand [email protected]
|
||||||
Hans Aberg [email protected]
|
Hans Aberg [email protected]
|
||||||
Jan Nieuwenhuizen [email protected]
|
Jan Nieuwenhuizen [email protected]
|
||||||
Jerry Quinn [email protected]
|
|
||||||
Jesse Thilo [email protected]
|
Jesse Thilo [email protected]
|
||||||
Jim Kent [email protected]
|
Jim Kent [email protected]
|
||||||
Jim Meyering [email protected]
|
Jim Meyering [email protected]
|
||||||
Joel E. Denny joeldenny@joeldenny.org
|
Joel E. Denny jdenny@ces.clemson.edu
|
||||||
Johan van Selst [email protected]
|
|
||||||
Jonathan Nieder [email protected]
|
|
||||||
Juan Manuel Guerrero [email protected]
|
Juan Manuel Guerrero [email protected]
|
||||||
Kees Zeelenberg [email protected]
|
Kees Zeelenberg [email protected]
|
||||||
Keith Browne [email protected]
|
Keith Browne [email protected]
|
||||||
Laurent Mascherpa [email protected]
|
Laurent Mascherpa [email protected]
|
||||||
Magnus Fromreide [email protected]
|
Magnus Fromreide [email protected]
|
||||||
Marc Autret [email protected]
|
Marc Autret [email protected]
|
||||||
Martin Jacobs [email protected]
|
|
||||||
Martin Mokrejs [email protected]
|
Martin Mokrejs [email protected]
|
||||||
Martin Nylin [email protected]
|
Martin Nylin [email protected]
|
||||||
Matt Kraai [email protected]
|
Matt Kraai [email protected]
|
||||||
Matt Rosing [email protected]
|
Matt Rosing [email protected]
|
||||||
Michael Hayes [email protected]
|
Michael Hayes [email protected]
|
||||||
Michael Raskin [email protected]
|
|
||||||
Mickael Labau [email protected]
|
Mickael Labau [email protected]
|
||||||
Mike Castle [email protected]
|
Mike Castle [email protected]
|
||||||
Neil Booth [email protected]
|
Neil Booth [email protected]
|
||||||
@@ -74,7 +59,6 @@ Nelson H. F. Beebe [email protected]
|
|||||||
Nicolas Burrus [email protected]
|
Nicolas Burrus [email protected]
|
||||||
Nicolas Tisserand [email protected]
|
Nicolas Tisserand [email protected]
|
||||||
Noah Friedman [email protected]
|
Noah Friedman [email protected]
|
||||||
Odd Arild Olsen [email protected]
|
|
||||||
Oleg Smolsky [email protected]
|
Oleg Smolsky [email protected]
|
||||||
Paolo Bonzini [email protected]
|
Paolo Bonzini [email protected]
|
||||||
Pascal Bart [email protected]
|
Pascal Bart [email protected]
|
||||||
@@ -87,23 +71,20 @@ Piotr Gackiewicz [email protected]
|
|||||||
Quoc Peyrot [email protected]
|
Quoc Peyrot [email protected]
|
||||||
R Blake [email protected]
|
R Blake [email protected]
|
||||||
Raja R Harinath [email protected]
|
Raja R Harinath [email protected]
|
||||||
Ralf Wildenhues [email protected]
|
|
||||||
Richard Stallman [email protected]
|
Richard Stallman [email protected]
|
||||||
Robert Anisko [email protected]
|
Robert Anisko [email protected]
|
||||||
Satya Kiran Popuri [email protected]
|
Satya Kiran Popuri [email protected]
|
||||||
Sebastian Setzer [email protected]
|
|
||||||
Sebastien Fricker [email protected]
|
Sebastien Fricker [email protected]
|
||||||
Sergei Steshenko sergstesh@yahoo.com
|
Sebastian Setzer sebastian.setzer.ext@siemens.com
|
||||||
Shura [email protected]
|
Shura [email protected]
|
||||||
Steve Murphy [email protected]
|
Steve Murphy [email protected]
|
||||||
Summum Bonum [email protected]
|
|
||||||
Tim Josling [email protected]
|
Tim Josling [email protected]
|
||||||
Tim Van Holder [email protected]
|
Tim Van Holder [email protected]
|
||||||
Tom Lane [email protected]
|
Tom Lane [email protected]
|
||||||
Tom Tromey [email protected]
|
Tom Tromey [email protected]
|
||||||
Tommy Nordgren [email protected]
|
Tommy Nordgren [email protected]
|
||||||
Troy A. Johnson [email protected]
|
Troy A. Johnson [email protected]
|
||||||
Tys Lefering twlevo@gmail.com
|
Tys Lefering twlevo@xs4all.nl
|
||||||
Vin Shelton [email protected]
|
Vin Shelton [email protected]
|
||||||
Wayne Green [email protected]
|
Wayne Green [email protected]
|
||||||
Wolfram Wagner [email protected]
|
Wolfram Wagner [email protected]
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ parser") refers to the current `output' format.
|
|||||||
** vector
|
** vector
|
||||||
Move to using vector, drop stack.hh.
|
Move to using vector, drop stack.hh.
|
||||||
|
|
||||||
|
** I18n
|
||||||
|
Catch up with yacc.c.
|
||||||
|
|
||||||
* Report
|
* Report
|
||||||
|
|
||||||
** GLR
|
** GLR
|
||||||
@@ -287,7 +290,8 @@ Equip the parser with a means to create the (visual) parse tree.
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2001-2004, 2006, 2008-2011 Free Software Foundation, Inc.
|
Copyright (C) 2001, 2002, 2003, 2004, 2006 Free Software Foundation,
|
||||||
|
Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
|||||||
+17
-25
@@ -1,6 +1,6 @@
|
|||||||
# Bootstrap configuration.
|
# Bootstrap configuration.
|
||||||
|
|
||||||
# Copyright (C) 2006-2011 Free Software Foundation, Inc.
|
# Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -17,17 +17,17 @@
|
|||||||
|
|
||||||
# gnulib modules used by this package.
|
# gnulib modules used by this package.
|
||||||
gnulib_modules='
|
gnulib_modules='
|
||||||
announce-gen argmatch assert calloc-posix close config-h c-strcase
|
argmatch config-h c-strcase configmake
|
||||||
configmake dirname error extensions fopen-safer gendocs getopt-gnu
|
dirname error extensions fopen-safer git-version-gen
|
||||||
gettext git-version-gen hash inttypes isnan javacomp-script
|
getopt gettext hash inttypes javacomp-script javaexec-script malloc
|
||||||
javaexec-script ldexpl maintainer-makefile malloc-gnu mbschr mbsrchr
|
mbswidth obstack quote quotearg stdbool stpcpy strerror strtoul
|
||||||
mbswidth obstack perror pipe-posix quote quotearg realloc-posix
|
strverscmp unistd unistd-safer unlocked-io verify xalloc xalloc-die
|
||||||
spawn-pipe stdbool stpcpy strdup-posix strerror strtoul strverscmp
|
xstrndup
|
||||||
unistd unistd-safer unlocked-io update-copyright unsetenv verify
|
'
|
||||||
warnings xalloc xalloc-die xstrndup
|
|
||||||
|
|
||||||
fprintf-posix printf-posix snprintf-posix sprintf-posix
|
# Any gnulib files needed that are not in modules.
|
||||||
vsnprintf-posix vsprintf-posix
|
gnulib_files='
|
||||||
|
m4/warning.m4
|
||||||
'
|
'
|
||||||
|
|
||||||
# Additional xgettext options to use. Use "\\\newline" to break lines.
|
# Additional xgettext options to use. Use "\\\newline" to break lines.
|
||||||
@@ -46,30 +46,22 @@ XGETTEXT_OPTIONS_RUNTIME=$XGETTEXT_OPTIONS'\\\
|
|||||||
# Gettext supplies these files, but we don't need them since
|
# Gettext supplies these files, but we don't need them since
|
||||||
# we don't have an intl subdirectory.
|
# we don't have an intl subdirectory.
|
||||||
excluded_files='
|
excluded_files='
|
||||||
|
m4/codeset.m4
|
||||||
m4/glibc2.m4
|
m4/glibc2.m4
|
||||||
|
m4/glibc21.m4
|
||||||
m4/intdiv0.m4
|
m4/intdiv0.m4
|
||||||
m4/intl.m4
|
m4/intl.m4
|
||||||
m4/intldir.m4
|
m4/intldir.m4
|
||||||
m4/intmax.m4
|
m4/intmax.m4
|
||||||
|
m4/inttypes_h.m4
|
||||||
m4/lcmessage.m4
|
m4/lcmessage.m4
|
||||||
m4/lock.m4
|
m4/lock.m4
|
||||||
m4/longdouble.m4
|
m4/longdouble.m4
|
||||||
|
m4/printf-posix.m4
|
||||||
m4/signed.m4
|
m4/signed.m4
|
||||||
|
m4/size_max.m4
|
||||||
m4/uintmax_t.m4
|
m4/uintmax_t.m4
|
||||||
m4/ulonglong.m4
|
m4/ulonglong.m4
|
||||||
m4/visibility.m4
|
m4/visibility.m4
|
||||||
|
m4/xsize.m4
|
||||||
'
|
'
|
||||||
|
|
||||||
bootstrap_epilogue()
|
|
||||||
{
|
|
||||||
# Make sure we don't need src/bison, which usually doesn't exist at
|
|
||||||
# the time of a bootstrap.
|
|
||||||
touch src/parse-gram.[ch]
|
|
||||||
}
|
|
||||||
|
|
||||||
# Keep our bootstrap script in sync with gnulib's. If we ever need to
|
|
||||||
# maintain our own bootstrap script again, set this to false, remove
|
|
||||||
# the bootstrap entry from the file .x-update-copyright, and add any
|
|
||||||
# needed copyright years to the copyright statement in the bootstrap
|
|
||||||
# script.
|
|
||||||
bootstrap_sync=true
|
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
Makefile
|
||||||
|
Makefile.in
|
||||||
|
compile
|
||||||
|
config.guess
|
||||||
|
config.rpath
|
||||||
|
config.sub
|
||||||
|
depcomp
|
||||||
|
git-version-gen
|
||||||
|
install-sh
|
||||||
|
javacomp.sh.in
|
||||||
|
javaexec.sh.in
|
||||||
|
link-warning.h
|
||||||
|
mdate-sh
|
||||||
|
missing
|
||||||
|
texinfo.tex
|
||||||
|
ylwrap
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
|
|
||||||
/Makefile
|
|
||||||
/Makefile.in
|
|
||||||
/announce-gen
|
|
||||||
/arg-nonnull.h
|
|
||||||
/c++defs.h
|
|
||||||
/compile
|
|
||||||
/config.guess
|
|
||||||
/config.rpath
|
|
||||||
/config.sub
|
|
||||||
/depcomp
|
|
||||||
/gendocs.sh
|
|
||||||
/git-version-gen
|
|
||||||
/install-sh
|
|
||||||
/javacomp.sh.in
|
|
||||||
/javaexec.sh.in
|
|
||||||
/link-warning.h
|
|
||||||
/mdate-sh
|
|
||||||
/missing
|
|
||||||
/texinfo.tex
|
|
||||||
/update-copyright
|
|
||||||
/useless-if-before-free
|
|
||||||
/vc-list-files
|
|
||||||
/warn-on-use.h
|
|
||||||
/ylwrap
|
|
||||||
|
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
||||||
EXTRA_DIST = prev-version.txt cross-options.pl update-b4-copyright
|
EXTRA_DIST = prev-version.txt cross-options.pl
|
||||||
|
|||||||
+16
-58
@@ -5,75 +5,33 @@ use 5.005;
|
|||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
my %option;
|
my %option;
|
||||||
my %directive;
|
while (<>)
|
||||||
my $scanner = `grep -i '"%[a-z]' $ARGV[0]`;
|
|
||||||
$scanner =~ s/"\[-_\]"/-/g;
|
|
||||||
while (<STDIN>)
|
|
||||||
{
|
{
|
||||||
if (/^\s* # Initial spaces.
|
if (/^\s* # Initial spaces.
|
||||||
(?:(-\w),\s+)? # $1: $short: Possible short option.
|
(?:(-\w),\s+)? # $1: Possible short option.
|
||||||
(--[-\w]+) # $2: $long: Long option.
|
(--[-\w]+) # $2: Long option.
|
||||||
(\[?) # $3: $opt: '[' iff the argument is optional.
|
(\[?) # $3: '[' iff the argument is optional.
|
||||||
(?:=(\S+))? # $4: $arg: Possible argument name.
|
(?:=([-\w]+))? # $4: Possible argument name.
|
||||||
\s # Spaces.
|
|
||||||
/x)
|
/x)
|
||||||
{
|
{
|
||||||
my ($short, $long, $opt, $arg) = ($1, $2, $3, $4);
|
my ($short, $long, $opt, $arg) = ($1, $2, $3, $4);
|
||||||
$short = '' if ! defined $short;
|
$short = defined $short ? '@option{' . $short . '}' : '';
|
||||||
$short = '-d' if $long eq '--defines' && ! $short;
|
|
||||||
my $dir = '%' . substr($long, 2);
|
|
||||||
if (index ($scanner, "\"$dir\"") < 0)
|
|
||||||
{
|
|
||||||
if ($long eq '--force-define') { $dir = '%define'; }
|
|
||||||
else { $dir = ''; }
|
|
||||||
}
|
|
||||||
if ($arg)
|
if ($arg)
|
||||||
{
|
{
|
||||||
# if $opt, $arg contains the closing ].
|
|
||||||
substr ($arg, -1) = ''
|
|
||||||
if $opt eq '[';
|
|
||||||
$arg =~ s/^=//;
|
$arg =~ s/^=//;
|
||||||
$arg = lc ($arg);
|
$arg = '@var{' . lc ($arg) . '}';
|
||||||
my $dir_arg = $arg;
|
$arg = '[' . $arg . ']'
|
||||||
# If the argument is compite (e.g., for --define[=NAME[=VALUE]]),
|
if $opt eq '[';
|
||||||
# put each word in @var, to build @var{name}[=@var{value}], not
|
$option{"$long=$arg"} = $short ? "$short $arg" : '';
|
||||||
# @var{name[=value]}].
|
}
|
||||||
$arg =~ s/(\w+)/\@var{$1}/g;
|
else
|
||||||
my $long_arg = "=$arg";
|
{
|
||||||
if ($opt eq '[') {
|
$option{"$long"} = "$short";
|
||||||
$long_arg = "[$long_arg]";
|
|
||||||
$arg = "[$arg]";
|
|
||||||
}
|
|
||||||
# For arguments of directives: this only works if all arguments
|
|
||||||
# are strings and have the same syntax as on the command line.
|
|
||||||
if ($dir_arg eq 'name[=value]')
|
|
||||||
{
|
|
||||||
$dir_arg = '@var{name} ["@var{value}"]';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$dir_arg =~ s/(\w+)/\@var{"$1"}/g;
|
|
||||||
$dir_arg = '[' . $dir_arg . ']'
|
|
||||||
if $opt eq '[';
|
|
||||||
}
|
|
||||||
$long = "$long$long_arg";
|
|
||||||
$short = "$short $arg" if $short && $short ne '-d';
|
|
||||||
$dir = "$dir $dir_arg" if $dir;
|
|
||||||
}
|
}
|
||||||
$option{$long} = $short;
|
|
||||||
$directive{$long} = $dir;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
my $sep = '';
|
|
||||||
foreach my $long (sort keys %option)
|
foreach my $long (sort keys %option)
|
||||||
{
|
{
|
||||||
# Avoid trailing spaces.
|
printf "\@item %-40s \@tab %s\n", '@option{' . $long . '}', $option{$long};
|
||||||
print $sep;
|
|
||||||
$sep = "\n";
|
|
||||||
print '@item @option{', $long, "}\n\@tab";
|
|
||||||
print ' @option{', $option{$long}, '}' if $option{$long};
|
|
||||||
print "\n\@tab";
|
|
||||||
print ' @code{', $directive{$long}, '}' if $directive{$long};
|
|
||||||
print "\n";
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,152 +0,0 @@
|
|||||||
#!/usr/bin/perl -0777 -pi
|
|
||||||
|
|
||||||
# Update b4_copyright invocations or b4_copyright_years definitions to
|
|
||||||
# include the current year.
|
|
||||||
|
|
||||||
# Copyright (C) 2009-2011 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 3, 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, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
use warnings;
|
|
||||||
|
|
||||||
my $margin = 72;
|
|
||||||
|
|
||||||
my $this_year = $ENV{UPDATE_COPYRIGHT_YEAR};
|
|
||||||
if (!$this_year || $this_year !~ m/^\d{4}$/)
|
|
||||||
{
|
|
||||||
my ($sec, $min, $hour, $mday, $month, $year) = localtime (time ());
|
|
||||||
$this_year = $year + 1900;
|
|
||||||
}
|
|
||||||
my $old_re = <<'EOF'
|
|
||||||
(
|
|
||||||
(?:^|\n)
|
|
||||||
#BEFORE
|
|
||||||
(?:
|
|
||||||
b4_copyright\(\[[^][]*]
|
|
||||||
| m4_(?:push|pop)def\(\[b4_copyright_years]
|
|
||||||
)
|
|
||||||
#AFTER
|
|
||||||
)
|
|
||||||
(?:
|
|
||||||
,\s*
|
|
||||||
(
|
|
||||||
\[\s* (?:\d{4}(?:,\s*|-))* (\d{4}) \s*]
|
|
||||||
)
|
|
||||||
)?
|
|
||||||
\)
|
|
||||||
EOF
|
|
||||||
;
|
|
||||||
|
|
||||||
while (/($old_re)/gx)
|
|
||||||
{
|
|
||||||
my $start = pos() - length ($1);
|
|
||||||
my $b4_copyright_line = $2;
|
|
||||||
my $year_lines = $3;
|
|
||||||
my $final_year = $4;
|
|
||||||
$year_lines .= ')';
|
|
||||||
|
|
||||||
# If there was a second argument, it contains years, so update them.
|
|
||||||
if ($final_year)
|
|
||||||
{
|
|
||||||
$b4_copyright_line .= ',';
|
|
||||||
if ($final_year != $this_year)
|
|
||||||
{
|
|
||||||
# Update the year.
|
|
||||||
$year_lines =~ s/$final_year/$final_year, $this_year/;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Normalize all whitespace.
|
|
||||||
$year_lines =~ s/\s+/ /g;
|
|
||||||
|
|
||||||
# Put spaces after commas.
|
|
||||||
$year_lines =~ s/, ?/, /g;
|
|
||||||
|
|
||||||
# Compress to intervals.
|
|
||||||
$year_lines =~
|
|
||||||
s/
|
|
||||||
(\d{4})
|
|
||||||
(?:
|
|
||||||
(,\ |-)
|
|
||||||
((??{
|
|
||||||
if ($2 eq '-') { '\d{4}'; }
|
|
||||||
elsif (!$3) { $1 + 1; }
|
|
||||||
else { $3 + 1; }
|
|
||||||
}))
|
|
||||||
)+
|
|
||||||
/$1-$3/gx;
|
|
||||||
|
|
||||||
# Format within margin.
|
|
||||||
my $year_lines_new;
|
|
||||||
my $indent = index ($b4_copyright_line, '[');
|
|
||||||
--$indent if ($b4_copyright_line =~ m/^\n/);
|
|
||||||
while (length $year_lines)
|
|
||||||
{
|
|
||||||
my $text_margin = $margin - $indent;
|
|
||||||
if (($year_lines =~ s/^(.{1,$text_margin})(?: |$)//)
|
|
||||||
|| ($year_lines =~ s/^([\S]+)(?: |$)//))
|
|
||||||
{
|
|
||||||
my $line = "\n" . (' 'x$indent) . $1;
|
|
||||||
++$indent if (!$year_lines_new);
|
|
||||||
$year_lines_new .= $line;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
# Should be unreachable, but we don't want an infinite
|
|
||||||
# loop if it can be reached.
|
|
||||||
die;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Replace the old invocation. Should never die.
|
|
||||||
die if (!s/$old_re\G/$b4_copyright_line$year_lines_new/x);
|
|
||||||
|
|
||||||
# Prepare for the next search.
|
|
||||||
pos () = $start + length ("$b4_copyright_line$year_lines_new");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
while (/(\bb4_copyright\()/g)
|
|
||||||
{
|
|
||||||
my $start = pos () - length ($1);
|
|
||||||
my $end = pos ();
|
|
||||||
my $re = $old_re;
|
|
||||||
pos () = $start;
|
|
||||||
$re =~ s/\#BEFORE/\\G/;
|
|
||||||
if (!/$re/x)
|
|
||||||
{
|
|
||||||
my $line = (substr ($_, 0, $start) =~ s/\n/\n/g) + 1;
|
|
||||||
print STDERR
|
|
||||||
"$ARGV:$line: warning: failed to update a b4_copyright\n";
|
|
||||||
}
|
|
||||||
pos () = $end;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (/(\[b4_copyright_years])/g)
|
|
||||||
{
|
|
||||||
my $start = pos () - length ($1);
|
|
||||||
my $end = pos ();
|
|
||||||
my $re = $old_re;
|
|
||||||
$re =~ s/\#AFTER/\\G/;
|
|
||||||
if (!/$re/x)
|
|
||||||
{
|
|
||||||
# The substr operation blows away pos (), so restoring pos ()
|
|
||||||
# at the end is necessary.
|
|
||||||
my $line = (substr ($_, 0, $start) =~ s/\n/\n/g) + 1;
|
|
||||||
print STDERR
|
|
||||||
"$ARGV:$line: warning: failed to update a"
|
|
||||||
. " b4_copyright_years\n";
|
|
||||||
}
|
|
||||||
pos () = $end;
|
|
||||||
}
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
#!/usr/bin/perl -0777 -pi
|
|
||||||
|
|
||||||
# In configure.ac, update PACKAGE_COPYRIGHT_YEAR to the current year.
|
|
||||||
|
|
||||||
# Copyright (C) 2010-2011 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 3, 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, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
use warnings;
|
|
||||||
|
|
||||||
my $this_year = $ENV{UPDATE_COPYRIGHT_YEAR};
|
|
||||||
if (!$this_year || $this_year !~ m/^\d{4}$/)
|
|
||||||
{
|
|
||||||
my ($sec, $min, $hour, $mday, $month, $year) = localtime (time ());
|
|
||||||
$this_year = $year + 1900;
|
|
||||||
}
|
|
||||||
my $old_re = <<'EOF'
|
|
||||||
(
|
|
||||||
MACRO\(
|
|
||||||
\[PACKAGE_COPYRIGHT_YEAR],
|
|
||||||
\s*\[
|
|
||||||
)
|
|
||||||
(\d{4})
|
|
||||||
(?=])
|
|
||||||
EOF
|
|
||||||
;
|
|
||||||
foreach my $macro ("AC_DEFINE", "AC_SUBST")
|
|
||||||
{
|
|
||||||
my $this_old_re = $old_re;
|
|
||||||
$this_old_re =~ s/MACRO/$macro/;
|
|
||||||
if (!s/$this_old_re/$1$this_year/x)
|
|
||||||
{
|
|
||||||
print STDERR
|
|
||||||
"$ARGV: warning: failed to update PACKAGE_COPYRIGHT_YEAR in"
|
|
||||||
. " $macro.\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+35
-55
@@ -1,6 +1,7 @@
|
|||||||
# Configure template for GNU Bison. -*-Autoconf-*-
|
# Configure template for GNU Bison. -*-Autoconf-*-
|
||||||
#
|
#
|
||||||
# Copyright (C) 2001-2011 Free Software Foundation, Inc.
|
# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software
|
||||||
|
# Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -15,36 +16,19 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# In order for some versions of Sun Studio to compile our C++ test cases
|
# We have strange test case titles, so we need Autoconf 2.61 or better.
|
||||||
# correctly, we need Autoconf 2.64 or better to handle the restrict
|
AC_PREREQ(2.61)
|
||||||
# keyword in at least string.h from gnulib.
|
|
||||||
AC_PREREQ(2.64)
|
|
||||||
|
|
||||||
AC_INIT([GNU Bison],
|
AC_INIT([GNU Bison], [2.3a+], [[email protected]])
|
||||||
m4_esyscmd([build-aux/git-version-gen .tarball-version]),
|
AC_DEFINE([PACKAGE_COPYRIGHT_YEAR], [2007],
|
||||||
[[email protected]])
|
|
||||||
AC_DEFINE([PACKAGE_COPYRIGHT_YEAR], [2011],
|
|
||||||
[The copyright year for this package])
|
[The copyright year for this package])
|
||||||
AC_SUBST([PACKAGE_COPYRIGHT_YEAR], [2011])
|
AC_SUBST([PACKAGE_COPYRIGHT_YEAR], [2007])
|
||||||
|
|
||||||
AC_CONFIG_AUX_DIR([build-aux])
|
AC_CONFIG_AUX_DIR([build-aux])
|
||||||
AC_CONFIG_MACRO_DIR([m4])
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
|
|
||||||
# Automake 1.10.3 and 1.11.1 fix a security flaw discussed here:
|
# We don't have a file m4/Makefile.am, so we need Automake 1.8 or later.
|
||||||
#
|
AM_INIT_AUTOMAKE([1.8 check-news readme-alpha dist-bzip2])
|
||||||
# http://thread.gmane.org/gmane.comp.sysutils.autotools.announce/131
|
|
||||||
#
|
|
||||||
# To avoid 1.11, we make 1.11.1 the minimum version.
|
|
||||||
#
|
|
||||||
# We want gnits strictness only when rolling a stable release. For
|
|
||||||
# release candidates, we use version strings like 2.4.3_rc1, but gnits
|
|
||||||
# doesn't like that, so we let the underscore disable gnits. Between
|
|
||||||
# releases, we want to be able run make dist without being required to
|
|
||||||
# add a bogus NEWS entry. In that case, the version string
|
|
||||||
# automatically contains a dash, which we also let disable gnits.
|
|
||||||
AM_INIT_AUTOMAKE([1.11.1 dist-bzip2]
|
|
||||||
m4_bmatch(m4_defn([AC_PACKAGE_VERSION]), [[-_]],
|
|
||||||
[gnu], [gnits]))
|
|
||||||
AC_CONFIG_HEADERS([lib/config.h:lib/config.hin])
|
AC_CONFIG_HEADERS([lib/config.h:lib/config.hin])
|
||||||
|
|
||||||
# Checks for the compiler.
|
# Checks for the compiler.
|
||||||
@@ -61,29 +45,24 @@ AC_ARG_ENABLE(gcc-warnings,
|
|||||||
esac],
|
esac],
|
||||||
[enableval=no])
|
[enableval=no])
|
||||||
if test "${enableval}" = yes; then
|
if test "${enableval}" = yes; then
|
||||||
gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
|
gl_WARNING_CFLAGS([-Werror])
|
||||||
AC_SUBST([WERROR_CFLAGS])
|
AC_SUBST([WERROR_CFLAGS], [$WARNING_CFLAGS])
|
||||||
gl_WARN_ADD([-Wall])
|
WARNING_CFLAGS=
|
||||||
gl_WARN_ADD([-Wextra -Wno-sign-compare])
|
gl_WARNING_CFLAGS([-Wall])
|
||||||
gl_WARN_ADD([-Wcast-align])
|
gl_WARNING_CFLAGS([-Wextra -Wno-sign-compare])
|
||||||
gl_WARN_ADD([-Wcast-qual])
|
gl_WARNING_CFLAGS([-Wcast-align])
|
||||||
gl_WARN_ADD([-Wformat])
|
gl_WARNING_CFLAGS([-Wcast-qual])
|
||||||
gl_WARN_ADD([-Wpointer-arith])
|
gl_WARNING_CFLAGS([-Wformat])
|
||||||
gl_WARN_ADD([-Wwrite-strings])
|
gl_WARNING_CFLAGS([-Wpointer-arith])
|
||||||
AC_SUBST([WARN_CXXFLAGS], [$WARN_CFLAGS])
|
gl_WARNING_CFLAGS([-Wwrite-strings])
|
||||||
|
AC_SUBST([WARNING_CXXFLAGS], [$WARNING_CFLAGS])
|
||||||
# The following warnings are not suitable for C++.
|
# The following warnings are not suitable for C++.
|
||||||
gl_WARN_ADD([-Wbad-function-cast])
|
gl_WARNING_CFLAGS([-Wbad-function-cast])
|
||||||
gl_WARN_ADD([-Wmissing-declarations])
|
gl_WARNING_CFLAGS([-Wmissing-declarations])
|
||||||
gl_WARN_ADD([-Wmissing-prototypes])
|
gl_WARNING_CFLAGS([-Wmissing-prototypes])
|
||||||
gl_WARN_ADD([-Wshadow])
|
gl_WARNING_CFLAGS([-Wshadow])
|
||||||
gl_WARN_ADD([-Wstrict-prototypes])
|
gl_WARNING_CFLAGS([-Wstrict-prototypes])
|
||||||
AC_SUBST([WARN_CFLAGS])
|
AC_DEFINE([lint], 1, [Define to 1 if the compiler is checking for lint.])
|
||||||
# Warnings for the test suite only.
|
|
||||||
gl_WARN_ADD([-Wundef], [WARN_CFLAGS_TEST])
|
|
||||||
WARN_CXXFLAGS_TEST="$WARN_CXXFLAGS $WARN_CFLAGS_TEST"
|
|
||||||
WARN_CFLAGS_TEST="$WARN_CFLAGS $WARN_CFLAGS_TEST"
|
|
||||||
AC_SUBST([WARN_CXXFLAGS_TEST])
|
|
||||||
AC_SUBST([WARN_CFLAGS_TEST])
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
BISON_TEST_FOR_WORKING_C_COMPILER
|
BISON_TEST_FOR_WORKING_C_COMPILER
|
||||||
@@ -107,10 +86,11 @@ AC_SUBST([YACC_LIBRARY])
|
|||||||
AC_PROG_LEX
|
AC_PROG_LEX
|
||||||
AC_PROG_YACC
|
AC_PROG_YACC
|
||||||
AC_PROG_RANLIB
|
AC_PROG_RANLIB
|
||||||
AC_PROG_GNU_M4
|
BISON_PROG_GNU_M4
|
||||||
|
if test x"$ac_cv_prog_gnu_m4" != xyes; then
|
||||||
|
AC_MSG_ERROR([GNU M4 1.4 is required])
|
||||||
|
fi
|
||||||
AC_DEFINE_UNQUOTED([M4], ["$M4"], [Define to the GNU M4 executable name.])
|
AC_DEFINE_UNQUOTED([M4], ["$M4"], [Define to the GNU M4 executable name.])
|
||||||
AC_DEFINE_UNQUOTED([M4_GNU_OPTION], ["$M4_GNU"], [Define to "-g" if GNU M4
|
|
||||||
supports -g, otherwise to "".])
|
|
||||||
AM_MISSING_PROG([HELP2MAN], [help2man])
|
AM_MISSING_PROG([HELP2MAN], [help2man])
|
||||||
AC_PATH_PROG([XSLTPROC], [xsltproc])
|
AC_PATH_PROG([XSLTPROC], [xsltproc])
|
||||||
AC_SUBST([XSLTPROC])
|
AC_SUBST([XSLTPROC])
|
||||||
@@ -132,10 +112,9 @@ BISON_PREREQ_SUBPIPE
|
|||||||
BISON_PREREQ_TIMEVAR
|
BISON_PREREQ_TIMEVAR
|
||||||
|
|
||||||
# Gettext.
|
# Gettext.
|
||||||
# We use gnulib, which is only guaranteed to work properly with the
|
# We've never tested with gettext versions before 0.15, so play it safe.
|
||||||
# latest Gettext.
|
AM_GNU_GETTEXT([external], [need-formatstring-macros])
|
||||||
AM_GNU_GETTEXT([external], [need-ngettext])
|
AM_GNU_GETTEXT_VERSION([0.15])
|
||||||
AM_GNU_GETTEXT_VERSION([0.18])
|
|
||||||
BISON_I18N
|
BISON_I18N
|
||||||
|
|
||||||
# Internationalized parsers.
|
# Internationalized parsers.
|
||||||
@@ -163,7 +142,8 @@ AC_SUBST([O0CXXFLAGS], [`echo $CXXFLAGS | sed 's/-O[[0-9]] *//'`])
|
|||||||
gt_JAVACOMP([1.3])
|
gt_JAVACOMP([1.3])
|
||||||
gt_JAVAEXEC
|
gt_JAVAEXEC
|
||||||
|
|
||||||
AC_CONFIG_FILES([Makefile
|
AC_CONFIG_FILES([.version
|
||||||
|
Makefile
|
||||||
build-aux/Makefile
|
build-aux/Makefile
|
||||||
po/Makefile.in
|
po/Makefile.in
|
||||||
data/Makefile
|
data/Makefile
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
/Makefile.in
|
|
||||||
/Makefile
|
|
||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
## Copyright (C) 2002, 2005-2011 Free Software Foundation, Inc.
|
## Copyright (C) 2002, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,7 +19,7 @@ dist_pkgdata_DATA = README bison.m4 \
|
|||||||
java-skel.m4 java.m4 lalr1.java
|
java-skel.m4 java.m4 lalr1.java
|
||||||
|
|
||||||
m4sugardir = $(pkgdatadir)/m4sugar
|
m4sugardir = $(pkgdatadir)/m4sugar
|
||||||
dist_m4sugar_DATA = m4sugar/m4sugar.m4 m4sugar/foreach.m4
|
dist_m4sugar_DATA = m4sugar/m4sugar.m4
|
||||||
|
|
||||||
xsltdir = $(pkgdatadir)/xslt
|
xsltdir = $(pkgdatadir)/xslt
|
||||||
dist_xslt_DATA = \
|
dist_xslt_DATA = \
|
||||||
|
|||||||
+7
-34
@@ -1,58 +1,31 @@
|
|||||||
-*- outline -*-
|
-*- outline -*-
|
||||||
|
|
||||||
This directory contains data needed by Bison.
|
This directory contains Bison skeletons: the general shapes of the
|
||||||
|
different parser kinds, that are specialized for specific grammars by
|
||||||
|
the bison program.
|
||||||
|
|
||||||
* Skeletons
|
Currently, there are only three supported skeletons:
|
||||||
Bison skeletons: the general shapes of the different parser kinds,
|
|
||||||
that are specialized for specific grammars by the bison program.
|
|
||||||
|
|
||||||
Currently, the supported skeletons are:
|
|
||||||
|
|
||||||
- yacc.c
|
- yacc.c
|
||||||
It used to be named bison.simple: it corresponds to C Yacc
|
It used to be named bison.simple: it corresponds to C Yacc
|
||||||
compatible LALR(1) parsers.
|
compatible LALR(1) parsers.
|
||||||
|
|
||||||
- lalr1.cc
|
- lalr1.cc
|
||||||
Produces a C++ parser class.
|
Produces a C++ parser class. It is still very experimental, and not
|
||||||
|
yet supported. Please, subscribe to [email protected].
|
||||||
- lalr1.java
|
|
||||||
Produces a Java parser class.
|
|
||||||
|
|
||||||
- glr.c
|
- glr.c
|
||||||
A Generalized LR C parser based on Bison's LALR(1) tables.
|
A Generalized LR C parser based on Bison's LALR(1) tables.
|
||||||
|
|
||||||
- glr.cc
|
|
||||||
A Generalized LR C++ parser. Actually a C++ wrapper around glr.c.
|
|
||||||
|
|
||||||
These skeletons are the only ones supported by the Bison team.
|
These skeletons are the only ones supported by the Bison team.
|
||||||
Because the interface between skeletons and the bison program is not
|
Because the interface between skeletons and the bison program is not
|
||||||
finished, *we are not bound to it*. In particular, Bison is not
|
finished, *we are not bound to it*. In particular, Bison is not
|
||||||
mature enough for us to consider that ``foreign skeletons'' are
|
mature enough for us to consider that ``foreign skeletons'' are
|
||||||
supported.
|
supported.
|
||||||
|
|
||||||
* m4sugar
|
|
||||||
This directory contains M4sugar, sort of an extended library for M4,
|
|
||||||
which is used by Bison to instantiate the skeletons.
|
|
||||||
|
|
||||||
* xslt
|
|
||||||
This directory contains XSLT programs that transform Bison's XML output
|
|
||||||
into various formats.
|
|
||||||
|
|
||||||
- bison.xsl
|
|
||||||
A library of routines used by the other XSLT programs.
|
|
||||||
|
|
||||||
- xml2dot.xsl
|
|
||||||
Conversion into GraphViz's dot format.
|
|
||||||
|
|
||||||
- xml2text.xsl
|
|
||||||
Conversion into text.
|
|
||||||
|
|
||||||
- xml2xhtml.xsl
|
|
||||||
Conversion into XHTML.
|
|
||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2002, 2008-2011 Free Software Foundation, Inc.
|
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GNU Bison.
|
This file is part of GNU Bison.
|
||||||
|
|
||||||
|
|||||||
+28
-50
@@ -1,8 +1,8 @@
|
|||||||
-*- Autoconf -*-
|
-*- Autoconf -*-
|
||||||
|
|
||||||
# Language-independent M4 Macros for Bison.
|
# Language-independent M4 Macros for Bison.
|
||||||
|
# Copyright (C) 2002, 2004, 2005, 2006, 2007, 2008 Free Software Foundation,
|
||||||
# Copyright (C) 2002, 2004-2011 Free Software Foundation, Inc.
|
# Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -312,13 +312,13 @@ b4_define_user_code([stype])
|
|||||||
|
|
||||||
|
|
||||||
# b4_check_user_names(WHAT, USER-LIST, BISON-NAMESPACE)
|
# b4_check_user_names(WHAT, USER-LIST, BISON-NAMESPACE)
|
||||||
# -----------------------------------------------------
|
# --------------------------------------------------------
|
||||||
# Complain if any name of type WHAT is used by the user (as recorded in
|
# Warn if any name of type WHAT is used by the user (as recorded in USER-LIST)
|
||||||
# USER-LIST) but is not used by Bison (as recorded by macros in the
|
# but is not used by Bison (as recorded by macros in the namespace
|
||||||
# namespace BISON-NAMESPACE).
|
# BISON-NAMESPACE).
|
||||||
#
|
#
|
||||||
# USER-LIST must expand to a list specifying all user occurrences of all names
|
# USER-LIST must expand to a list specifying all grammar occurrences of all
|
||||||
# of type WHAT. Each item in the list must be a triplet specifying one
|
# names of type WHAT. Each item in the list must be a triplet specifying one
|
||||||
# occurrence: name, start boundary, and end boundary. Empty string names are
|
# occurrence: name, start boundary, and end boundary. Empty string names are
|
||||||
# fine. An empty list is fine.
|
# fine. An empty list is fine.
|
||||||
#
|
#
|
||||||
@@ -353,35 +353,19 @@ m4_pushdef([b4_user_name], m4_car(b4_occurrence))dnl
|
|||||||
m4_pushdef([b4_start], m4_car(m4_shift(b4_occurrence)))dnl
|
m4_pushdef([b4_start], m4_car(m4_shift(b4_occurrence)))dnl
|
||||||
m4_pushdef([b4_end], m4_shift(m4_shift(b4_occurrence)))dnl
|
m4_pushdef([b4_end], m4_shift(m4_shift(b4_occurrence)))dnl
|
||||||
m4_ifndef($3[(]m4_quote(b4_user_name)[)],
|
m4_ifndef($3[(]m4_quote(b4_user_name)[)],
|
||||||
[b4_complain_at([b4_start], [b4_end],
|
[b4_warn_at([b4_start], [b4_end],
|
||||||
[[%s `%s' is not used]],
|
[[%s `%s' is not used]],
|
||||||
[$1], [b4_user_name])])[]dnl
|
[$1], [b4_user_name])])[]dnl
|
||||||
m4_popdef([b4_occurrence])dnl
|
m4_popdef([b4_occurrence])dnl
|
||||||
m4_popdef([b4_user_name])dnl
|
m4_popdef([b4_user_name])dnl
|
||||||
m4_popdef([b4_start])dnl
|
m4_popdef([b4_start])dnl
|
||||||
m4_popdef([b4_end])dnl
|
m4_popdef([b4_end])dnl
|
||||||
])])
|
])])
|
||||||
|
|
||||||
|
# b4_percent_define_get(VARIABLE)
|
||||||
|
|
||||||
|
|
||||||
## --------------------- ##
|
|
||||||
## b4_percent_define_*. ##
|
|
||||||
## --------------------- ##
|
|
||||||
|
|
||||||
|
|
||||||
# b4_percent_define_use(VARIABLE)
|
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
# Declare that VARIABLE was used.
|
# Mimic muscle_percent_define_get in ../src/muscle_tab.h exactly. That is, if
|
||||||
m4_define([b4_percent_define_use],
|
# the %define variable VARIABLE is defined, emit its value. Also, record
|
||||||
[m4_define([b4_percent_define_bison_variables(]$1[)])dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
# b4_percent_define_get(VARIABLE, [DEFAULT])
|
|
||||||
# ------------------------------------------
|
|
||||||
# Mimic muscle_percent_define_get in ../src/muscle-tab.h. That is, if
|
|
||||||
# the %define variable VARIABLE is defined, emit its value. Contrary
|
|
||||||
# to its C counterpart, return DEFAULT otherwise. Also, record
|
|
||||||
# Bison's usage of VARIABLE by defining
|
# Bison's usage of VARIABLE by defining
|
||||||
# b4_percent_define_bison_variables(VARIABLE).
|
# b4_percent_define_bison_variables(VARIABLE).
|
||||||
#
|
#
|
||||||
@@ -389,15 +373,12 @@ m4_define([b4_percent_define_use],
|
|||||||
#
|
#
|
||||||
# b4_percent_define_get([[foo]])
|
# b4_percent_define_get([[foo]])
|
||||||
m4_define([b4_percent_define_get],
|
m4_define([b4_percent_define_get],
|
||||||
[b4_percent_define_use([$1])dnl
|
[m4_define([b4_percent_define_bison_variables(]$1[)])dnl
|
||||||
m4_ifdef([b4_percent_define(]$1[)],
|
m4_ifdef([b4_percent_define(]$1[)], [m4_indir([b4_percent_define(]$1[)])])])
|
||||||
[m4_indir([b4_percent_define(]$1[)])],
|
|
||||||
[$2])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_percent_define_get_loc(VARIABLE)
|
# b4_percent_define_get_loc(VARIABLE)
|
||||||
# -----------------------------------
|
# -----------------------------------
|
||||||
# Mimic muscle_percent_define_get_loc in ../src/muscle-tab.h exactly. That is,
|
# Mimic muscle_percent_define_get_loc in ../src/muscle_tab.h exactly. That is,
|
||||||
# if the %define variable VARIABLE is undefined, complain fatally since that's
|
# if the %define variable VARIABLE is undefined, complain fatally since that's
|
||||||
# a Bison or skeleton error. Otherwise, return its definition location in a
|
# a Bison or skeleton error. Otherwise, return its definition location in a
|
||||||
# form approriate for the first two arguments of b4_warn_at, b4_complain_at, or
|
# form approriate for the first two arguments of b4_warn_at, b4_complain_at, or
|
||||||
@@ -416,7 +397,7 @@ m4_popdef([b4_loc])],
|
|||||||
|
|
||||||
# b4_percent_define_get_syncline(VARIABLE)
|
# b4_percent_define_get_syncline(VARIABLE)
|
||||||
# ----------------------------------------
|
# ----------------------------------------
|
||||||
# Mimic muscle_percent_define_get_syncline in ../src/muscle-tab.h exactly.
|
# Mimic muscle_percent_define_get_syncline in ../src/muscle_tab.h exactly.
|
||||||
# That is, if the %define variable VARIABLE is undefined, complain fatally
|
# That is, if the %define variable VARIABLE is undefined, complain fatally
|
||||||
# since that's a Bison or skeleton error. Otherwise, return its definition
|
# since that's a Bison or skeleton error. Otherwise, return its definition
|
||||||
# location as a b4_syncline invocation. Don't record this as a Bison usage of
|
# location as a b4_syncline invocation. Don't record this as a Bison usage of
|
||||||
@@ -433,7 +414,7 @@ m4_define([b4_percent_define_get_syncline],
|
|||||||
|
|
||||||
# b4_percent_define_ifdef(VARIABLE, IF-TRUE, [IF-FALSE])
|
# b4_percent_define_ifdef(VARIABLE, IF-TRUE, [IF-FALSE])
|
||||||
# ------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
# Mimic muscle_percent_define_ifdef in ../src/muscle-tab.h exactly. That is,
|
# Mimic muscle_percent_define_ifdef in ../src/muscle_tab.h exactly. That is,
|
||||||
# if the %define variable VARIABLE is defined, expand IF-TRUE, else expand
|
# if the %define variable VARIABLE is defined, expand IF-TRUE, else expand
|
||||||
# IF-FALSE. Also, record Bison's usage of VARIABLE by defining
|
# IF-FALSE. Also, record Bison's usage of VARIABLE by defining
|
||||||
# b4_percent_define_bison_variables(VARIABLE).
|
# b4_percent_define_bison_variables(VARIABLE).
|
||||||
@@ -448,7 +429,7 @@ m4_define([b4_percent_define_ifdef],
|
|||||||
|
|
||||||
# b4_percent_define_flag_if(VARIABLE, IF-TRUE, [IF-FALSE])
|
# b4_percent_define_flag_if(VARIABLE, IF-TRUE, [IF-FALSE])
|
||||||
# --------------------------------------------------------
|
# --------------------------------------------------------
|
||||||
# Mimic muscle_percent_define_flag_if in ../src/muscle-tab.h exactly. That is,
|
# Mimic muscle_percent_define_flag_if in ../src/muscle_tab.h exactly. That is,
|
||||||
# if the %define variable VARIABLE is defined to "" or "true", expand IF-TRUE.
|
# if the %define variable VARIABLE is defined to "" or "true", expand IF-TRUE.
|
||||||
# If it is defined to "false", expand IF-FALSE. Complain if it is undefined
|
# If it is defined to "false", expand IF-FALSE. Complain if it is undefined
|
||||||
# (a Bison or skeleton error since the default value should have been set
|
# (a Bison or skeleton error since the default value should have been set
|
||||||
@@ -471,7 +452,7 @@ m4_define([b4_percent_define_flag_if],
|
|||||||
|
|
||||||
# b4_percent_define_default(VARIABLE, DEFAULT)
|
# b4_percent_define_default(VARIABLE, DEFAULT)
|
||||||
# --------------------------------------------
|
# --------------------------------------------
|
||||||
# Mimic muscle_percent_define_default in ../src/muscle-tab.h exactly. That is,
|
# Mimic muscle_percent_define_default in ../src/muscle_tab.h exactly. That is,
|
||||||
# if the %define variable VARIABLE is undefined, set its value to DEFAULT.
|
# if the %define variable VARIABLE is undefined, set its value to DEFAULT.
|
||||||
# Don't record this as a Bison usage of VARIABLE as there's no reason to
|
# Don't record this as a Bison usage of VARIABLE as there's no reason to
|
||||||
# suspect that the value has yet influenced the output.
|
# suspect that the value has yet influenced the output.
|
||||||
@@ -483,13 +464,14 @@ m4_define([b4_percent_define_default],
|
|||||||
[m4_ifndef([b4_percent_define(]$1[)],
|
[m4_ifndef([b4_percent_define(]$1[)],
|
||||||
[m4_define([b4_percent_define(]$1[)], [$2])dnl
|
[m4_define([b4_percent_define(]$1[)], [$2])dnl
|
||||||
m4_define([b4_percent_define_loc(]$1[)],
|
m4_define([b4_percent_define_loc(]$1[)],
|
||||||
[[[[<skeleton default value>:-1.-1]],
|
[[[[[Bison:b4_percent_define_default]:1.0]], [[[Bison:b4_percent_define_default]:1.0]]]])dnl
|
||||||
[[<skeleton default value>:-1.-1]]]])dnl
|
m4_define([b4_percent_define_syncline(]$1[)],
|
||||||
m4_define([b4_percent_define_syncline(]$1[)], [[]])])])
|
[[]b4_syncline(1, [["[Bison:b4_percent_define_default]"]])[
|
||||||
|
]])])])
|
||||||
|
|
||||||
# b4_percent_define_check_values(VALUES)
|
# b4_percent_define_check_values(VALUES)
|
||||||
# --------------------------------------
|
# --------------------------------------
|
||||||
# Mimic muscle_percent_define_check_values in ../src/muscle-tab.h exactly
|
# Mimic muscle_percent_define_check_values in ../src/muscle_tab.h exactly
|
||||||
# except that the VALUES structure is more appropriate for M4. That is, VALUES
|
# except that the VALUES structure is more appropriate for M4. That is, VALUES
|
||||||
# is a list of sublists of strings. For each sublist, the first string is the
|
# is a list of sublists of strings. For each sublist, the first string is the
|
||||||
# name of a %define variable, and all remaining strings in that sublist are the
|
# name of a %define variable, and all remaining strings in that sublist are the
|
||||||
@@ -518,11 +500,7 @@ m4_define([_b4_percent_define_check_values],
|
|||||||
[b4_complain_at(b4_percent_define_get_loc([$1]),
|
[b4_complain_at(b4_percent_define_get_loc([$1]),
|
||||||
[[invalid value for %%define variable `%s': `%s']],
|
[[invalid value for %%define variable `%s': `%s']],
|
||||||
[$1],
|
[$1],
|
||||||
m4_dquote(m4_indir([b4_percent_define(]$1[)])))
|
m4_dquote(m4_indir([b4_percent_define(]$1[)])))])dnl
|
||||||
m4_foreach([b4_value], m4_dquote(m4_shift($@)),
|
|
||||||
[b4_complain_at(b4_percent_define_get_loc([$1]),
|
|
||||||
[[accepted value: `%s']],
|
|
||||||
m4_dquote(b4_value))])])dnl
|
|
||||||
m4_popdef([b4_good_value])],
|
m4_popdef([b4_good_value])],
|
||||||
[b4_fatal([[undefined %%define variable `%s' passed to b4_percent_define_check_values]], [$1])])])
|
[b4_fatal([[undefined %%define variable `%s' passed to b4_percent_define_check_values]], [$1])])])
|
||||||
|
|
||||||
@@ -572,7 +550,7 @@ m4_define([b4_check_user_names_wrap],
|
|||||||
[b4_percent_]$1[_user_]$2[s],
|
[b4_percent_]$1[_user_]$2[s],
|
||||||
[[b4_percent_]$1[_bison_]$2[s]])])])
|
[[b4_percent_]$1[_bison_]$2[s]])])])
|
||||||
|
|
||||||
m4_wrap_lifo([
|
m4_wrap([
|
||||||
b4_check_user_names_wrap([[define]], [[variable]])
|
b4_check_user_names_wrap([[define]], [[variable]])
|
||||||
b4_check_user_names_wrap([[code]], [[qualifier]])
|
b4_check_user_names_wrap([[code]], [[qualifier]])
|
||||||
])
|
])
|
||||||
|
|||||||
+1
-2
@@ -1,8 +1,7 @@
|
|||||||
-*- Autoconf -*-
|
-*- Autoconf -*-
|
||||||
|
|
||||||
# C++ skeleton dispatching for Bison.
|
# C++ skeleton dispatching for Bison.
|
||||||
|
# Copyright (C) 2006, 2007 Free Software Foundation, Inc.
|
||||||
# Copyright (C) 2006-2007, 2009-2011 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+6
-10
@@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
# C++ skeleton for Bison
|
# C++ skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 2002-2011 Free Software Foundation, Inc.
|
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation,
|
||||||
|
# Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -25,12 +26,7 @@ m4_include(b4_pkgdatadir/[c.m4])
|
|||||||
|
|
||||||
# Default parser class name.
|
# Default parser class name.
|
||||||
b4_percent_define_default([[parser_class_name]], [[parser]])
|
b4_percent_define_default([[parser_class_name]], [[parser]])
|
||||||
|
b4_percent_define_default([[location_type]], [[location]])
|
||||||
# Don't do that so that we remember whether we're using a user
|
|
||||||
# request, or the default value.
|
|
||||||
#
|
|
||||||
# b4_percent_define_default([[location_type]], [[location]])
|
|
||||||
|
|
||||||
b4_percent_define_default([[filename_type]], [[std::string]])
|
b4_percent_define_default([[filename_type]], [[std::string]])
|
||||||
b4_percent_define_default([[namespace]], m4_defn([b4_prefix]))
|
b4_percent_define_default([[namespace]], m4_defn([b4_prefix]))
|
||||||
b4_percent_define_default([[global_tokens_and_yystype]], [[false]])
|
b4_percent_define_default([[global_tokens_and_yystype]], [[false]])
|
||||||
@@ -78,10 +74,10 @@ m4_define([b4_namespace_open],
|
|||||||
|
|
||||||
m4_define([b4_namespace_close],
|
m4_define([b4_namespace_close],
|
||||||
[b4_user_code([b4_percent_define_get_syncline([[namespace]])
|
[b4_user_code([b4_percent_define_get_syncline([[namespace]])
|
||||||
m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote(b4_namespace_ref[ ]),
|
m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote(b4_namespace_ref),
|
||||||
[^\(.\)[ ]*\(::\)?\([^][:]\|:[^:]\)*],
|
[^\(.\)[ ]*\(::\)?\([^][:]\|:[^][:]\)*],
|
||||||
[\1])),
|
[\1])),
|
||||||
[::\([^][:]\|:[^:]\)*], [} ])[} // ]b4_namespace_ref])])
|
[::\([^][:]\|:[^][:]\)*], [} ])[} // ]b4_namespace_ref])])
|
||||||
|
|
||||||
|
|
||||||
# b4_token_enums(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
|
# b4_token_enums(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
|
||||||
|
|||||||
+1
-2
@@ -1,8 +1,7 @@
|
|||||||
-*- Autoconf -*-
|
-*- Autoconf -*-
|
||||||
|
|
||||||
# C skeleton dispatching for Bison.
|
# C skeleton dispatching for Bison.
|
||||||
|
# Copyright (C) 2006, 2007 Free Software Foundation, Inc.
|
||||||
# Copyright (C) 2006-2007, 2009-2011 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
-*- Autoconf -*-
|
-*- Autoconf -*-
|
||||||
|
|
||||||
# C M4 Macros for Bison.
|
# C M4 Macros for Bison.
|
||||||
|
# Copyright (C) 2002, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||||
# Copyright (C) 2002, 2004-2011 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -31,7 +30,7 @@ m4_define([b4_comment], [/* m4_bpatsubst([$1], [
|
|||||||
# -----------------
|
# -----------------
|
||||||
# Depends on individual skeletons to define b4_pure_flag, b4_push_flag, or
|
# Depends on individual skeletons to define b4_pure_flag, b4_push_flag, or
|
||||||
# b4_pull_flag if they use the values of the %define variables api.pure or
|
# b4_pull_flag if they use the values of the %define variables api.pure or
|
||||||
# api.push-pull.
|
# api.push_pull.
|
||||||
m4_define([b4_identification],
|
m4_define([b4_identification],
|
||||||
[[/* Identify Bison output. */
|
[[/* Identify Bison output. */
|
||||||
#define YYBISON 1
|
#define YYBISON 1
|
||||||
@@ -90,7 +89,7 @@ b4_parse_param)
|
|||||||
# the formal name to FORMAL, and evaluating the BODY.
|
# the formal name to FORMAL, and evaluating the BODY.
|
||||||
m4_define([b4_parse_param_for],
|
m4_define([b4_parse_param_for],
|
||||||
[m4_foreach([$1_$2], m4_defn([b4_parse_param]),
|
[m4_foreach([$1_$2], m4_defn([b4_parse_param]),
|
||||||
[m4_pushdef([$1], m4_unquote(m4_car($1_$2)))dnl
|
[m4_pushdef([$1], m4_fst($1_$2))dnl
|
||||||
m4_pushdef([$2], m4_shift($1_$2))dnl
|
m4_pushdef([$2], m4_shift($1_$2))dnl
|
||||||
$3[]dnl
|
$3[]dnl
|
||||||
m4_popdef([$2])dnl
|
m4_popdef([$2])dnl
|
||||||
@@ -133,19 +132,6 @@ m4_define([b4_int_type],
|
|||||||
m4_define([b4_int_type_for],
|
m4_define([b4_int_type_for],
|
||||||
[b4_int_type($1_min, $1_max)])
|
[b4_int_type($1_min, $1_max)])
|
||||||
|
|
||||||
|
|
||||||
# b4_table_value_equals(TABLE, VALUE, LITERAL)
|
|
||||||
# --------------------------------------------
|
|
||||||
# Without inducing a comparison warning from the compiler, check if the
|
|
||||||
# literal value LITERAL equals VALUE from table TABLE, which must have
|
|
||||||
# TABLE_min and TABLE_max defined. YYID must be defined as an identity
|
|
||||||
# function that suppresses warnings about constant conditions.
|
|
||||||
m4_define([b4_table_value_equals],
|
|
||||||
[m4_if(m4_eval($3 < m4_indir([b4_]$1[_min])
|
|
||||||
|| m4_indir([b4_]$1[_max]) < $3), [1],
|
|
||||||
[[YYID (0)]],
|
|
||||||
[[((]$2[) == (]$3[))]])])
|
|
||||||
|
|
||||||
## ---------##
|
## ---------##
|
||||||
## Values. ##
|
## Values. ##
|
||||||
## ---------##
|
## ---------##
|
||||||
@@ -157,8 +143,6 @@ m4_define([b4_table_value_equals],
|
|||||||
m4_define([b4_null], [0])
|
m4_define([b4_null], [0])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## ------------------------- ##
|
## ------------------------- ##
|
||||||
## Assigning token numbers. ##
|
## Assigning token numbers. ##
|
||||||
## ------------------------- ##
|
## ------------------------- ##
|
||||||
@@ -175,7 +159,7 @@ m4_define([b4_token_define],
|
|||||||
# -------------------------------------------------------
|
# -------------------------------------------------------
|
||||||
# Output the definition of the tokens (if there are) as #defines.
|
# Output the definition of the tokens (if there are) as #defines.
|
||||||
m4_define([b4_token_defines],
|
m4_define([b4_token_defines],
|
||||||
[m4_if([$#$1], [1], [],
|
[m4_if([$@], [[]], [],
|
||||||
[/* Tokens. */
|
[/* Tokens. */
|
||||||
m4_map([b4_token_define], [$@])])
|
m4_map([b4_token_define], [$@])])
|
||||||
])
|
])
|
||||||
@@ -192,7 +176,7 @@ m4_define([b4_token_enum],
|
|||||||
# -----------------------------------------------------
|
# -----------------------------------------------------
|
||||||
# Output the definition of the tokens (if there are) as enums.
|
# Output the definition of the tokens (if there are) as enums.
|
||||||
m4_define([b4_token_enums],
|
m4_define([b4_token_enums],
|
||||||
[m4_if([$#$1], [1], [],
|
[m4_if([$@], [[]], [],
|
||||||
[/* Tokens. */
|
[/* Tokens. */
|
||||||
#ifndef YYTOKENTYPE
|
#ifndef YYTOKENTYPE
|
||||||
# define YYTOKENTYPE
|
# define YYTOKENTYPE
|
||||||
@@ -244,8 +228,8 @@ m4_define([b4_c_function_def],
|
|||||||
b4_c_ansi_function_def($@)
|
b4_c_ansi_function_def($@)
|
||||||
#else
|
#else
|
||||||
$2
|
$2
|
||||||
$1 (b4_c_knr_formal_names(m4_shift2($@)))
|
$1 (b4_c_knr_formal_names(m4_shiftn(2, $@)))
|
||||||
b4_c_knr_formal_decls(m4_shift2($@))
|
b4_c_knr_formal_decls(m4_shiftn(2, $@))
|
||||||
#endif[]dnl
|
#endif[]dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -255,7 +239,7 @@ b4_c_knr_formal_decls(m4_shift2($@))
|
|||||||
# Declare the function NAME in ANSI.
|
# Declare the function NAME in ANSI.
|
||||||
m4_define([b4_c_ansi_function_def],
|
m4_define([b4_c_ansi_function_def],
|
||||||
[$2
|
[$2
|
||||||
$1 (b4_c_ansi_formals(m4_shift2($@)))[]dnl
|
$1 (b4_c_ansi_formals(m4_shiftn(2, $@)))[]dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
@@ -263,8 +247,9 @@ $1 (b4_c_ansi_formals(m4_shift2($@)))[]dnl
|
|||||||
# --------------------------------------
|
# --------------------------------------
|
||||||
# Output the arguments ANSI-C definition.
|
# Output the arguments ANSI-C definition.
|
||||||
m4_define([b4_c_ansi_formals],
|
m4_define([b4_c_ansi_formals],
|
||||||
[m4_if([$#], [0], [void],
|
[m4_case([$@],
|
||||||
[$#$1], [1], [void],
|
[], [void],
|
||||||
|
[[]], [void],
|
||||||
[m4_map_sep([b4_c_ansi_formal], [, ], [$@])])])
|
[m4_map_sep([b4_c_ansi_formal], [, ], [$@])])])
|
||||||
|
|
||||||
m4_define([b4_c_ansi_formal],
|
m4_define([b4_c_ansi_formal],
|
||||||
@@ -316,7 +301,7 @@ $2 $1 ();
|
|||||||
# ----------------------------------------------------------------
|
# ----------------------------------------------------------------
|
||||||
# Declare the function NAME.
|
# Declare the function NAME.
|
||||||
m4_define([b4_c_ansi_function_decl],
|
m4_define([b4_c_ansi_function_decl],
|
||||||
[$2 $1 (b4_c_ansi_formals(m4_shift2($@)));[]dnl
|
[$2 $1 (b4_c_ansi_formals(m4_shiftn(2, $@)));[]dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
@@ -331,7 +316,7 @@ m4_define([b4_c_ansi_function_decl],
|
|||||||
# -----------------------------------------------------------
|
# -----------------------------------------------------------
|
||||||
# Call the function NAME with arguments NAME1, NAME2 etc.
|
# Call the function NAME with arguments NAME1, NAME2 etc.
|
||||||
m4_define([b4_c_function_call],
|
m4_define([b4_c_function_call],
|
||||||
[$1 (b4_c_args(m4_shift2($@)))[]dnl
|
[$1 (b4_c_args(m4_shiftn(2, $@)))[]dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+126
-151
@@ -1,8 +1,8 @@
|
|||||||
-*- C -*-
|
-*- C -*-
|
||||||
|
|
||||||
# GLR skeleton for Bison
|
# GLR skeleton for Bison
|
||||||
|
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation,
|
||||||
# Copyright (C) 2002-2011 Free Software Foundation, Inc.
|
# Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -35,8 +35,8 @@ m4_define_default([b4_stack_depth_init], [200])
|
|||||||
## ------------------------ ##
|
## ------------------------ ##
|
||||||
|
|
||||||
b4_define_flag_if([pure])
|
b4_define_flag_if([pure])
|
||||||
# If glr.cc is including this file and thus has already set b4_pure_flag,
|
# If glr.cc is including this file and thus has already set b4_pure_flag, don't
|
||||||
# do not change the value of b4_pure_flag, and do not record a use of api.pure.
|
# change the value of b4_pure_flag, and don't record a use of api.pure.
|
||||||
m4_ifndef([b4_pure_flag],
|
m4_ifndef([b4_pure_flag],
|
||||||
[b4_percent_define_default([[api.pure]], [[false]])
|
[b4_percent_define_default([[api.pure]], [[false]])
|
||||||
m4_define([b4_pure_flag],
|
m4_define([b4_pure_flag],
|
||||||
@@ -148,9 +148,9 @@ m4_define([b4_rhs_location],
|
|||||||
# We do want M4 expansion after # for CPP macros.
|
# We do want M4 expansion after # for CPP macros.
|
||||||
m4_changecom()
|
m4_changecom()
|
||||||
m4_divert_push(0)dnl
|
m4_divert_push(0)dnl
|
||||||
@output(b4_parser_file_name@)@
|
@output(b4_parser_file_name@)
|
||||||
b4_copyright([Skeleton implementation for Bison GLR parsers in C],
|
b4_copyright([Skeleton implementation for Bison GLR parsers in C],
|
||||||
[2002-2011])
|
[2002, 2003, 2004, 2005, 2006])
|
||||||
[
|
[
|
||||||
/* C GLR parser skeleton written by Paul Hilfinger. */
|
/* C GLR parser skeleton written by Paul Hilfinger. */
|
||||||
|
|
||||||
@@ -248,7 +248,7 @@ b4_percent_code_get[]dnl
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifndef YY_
|
#ifndef YY_
|
||||||
# if defined YYENABLE_NLS && YYENABLE_NLS
|
# if YYENABLE_NLS
|
||||||
# if ENABLE_NLS
|
# if ENABLE_NLS
|
||||||
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
|
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
|
||||||
# define YY_(msgid) dgettext ("bison-runtime", msgid)
|
# define YY_(msgid) dgettext ("bison-runtime", msgid)
|
||||||
@@ -310,8 +310,7 @@ b4_percent_code_get[]dnl
|
|||||||
#ifndef __attribute__
|
#ifndef __attribute__
|
||||||
/* This feature is available in gcc versions 2.5 and later. */
|
/* This feature is available in gcc versions 2.5 and later. */
|
||||||
# if (! defined __GNUC__ || __GNUC__ < 2 \
|
# if (! defined __GNUC__ || __GNUC__ < 2 \
|
||||||
|| (__GNUC__ == 2 && __GNUC_MINOR__ < 5) \
|
|| (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__)
|
||||||
|| (defined __STRICT_ANSI__ && __STRICT_ANSI__))
|
|
||||||
# define __attribute__(Spec) /* empty */
|
# define __attribute__(Spec) /* empty */
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
@@ -413,9 +412,9 @@ static const ]b4_int_type_for([b4_merger])[ yymerger[] =
|
|||||||
]b4_merger[
|
]b4_merger[
|
||||||
};
|
};
|
||||||
|
|
||||||
/* YYDEFACT[S] -- default reduction number in state S. Performed when
|
/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
|
||||||
YYTABLE doesn't specify something else to do. Zero means the default
|
doesn't specify something else to do. Zero means the default is an
|
||||||
is an error. */
|
error. */
|
||||||
static const ]b4_int_type_for([b4_defact])[ yydefact[] =
|
static const ]b4_int_type_for([b4_defact])[ yydefact[] =
|
||||||
{
|
{
|
||||||
]b4_defact[
|
]b4_defact[
|
||||||
@@ -443,7 +442,8 @@ static const ]b4_int_type_for([b4_pgoto])[ yypgoto[] =
|
|||||||
|
|
||||||
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
|
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
|
||||||
positive, shift that token. If negative, reduce the rule which
|
positive, shift that token. If negative, reduce the rule which
|
||||||
number is the opposite. If YYTABLE_NINF, syntax error. */
|
number is the opposite. If zero, do what YYDEFACT says.
|
||||||
|
If YYTABLE_NINF, syntax error. */
|
||||||
#define YYTABLE_NINF ]b4_table_ninf[
|
#define YYTABLE_NINF ]b4_table_ninf[
|
||||||
static const ]b4_int_type_for([b4_table])[ yytable[] =
|
static const ]b4_int_type_for([b4_table])[ yytable[] =
|
||||||
{
|
{
|
||||||
@@ -1013,15 +1013,17 @@ yylhsNonterm (yyRuleNum yyrule)
|
|||||||
return yyr1[yyrule];
|
return yyr1[yyrule];
|
||||||
}
|
}
|
||||||
|
|
||||||
#define yypact_value_is_default(yystate) \
|
#define yyis_pact_ninf(yystate) \
|
||||||
]b4_table_value_equals([[pact]], [[yystate]], [b4_pact_ninf])[
|
]m4_if(m4_eval(b4_pact_ninf < b4_pact_min), [1],
|
||||||
|
[0],
|
||||||
|
[((yystate) == YYPACT_NINF)])[
|
||||||
|
|
||||||
/** True iff LR state STATE has only a default reduction (regardless
|
/** True iff LR state STATE has only a default reduction (regardless
|
||||||
* of token). */
|
* of token). */
|
||||||
static inline yybool
|
static inline yybool
|
||||||
yyisDefaultedState (yyStateNum yystate)
|
yyisDefaultedState (yyStateNum yystate)
|
||||||
{
|
{
|
||||||
return yypact_value_is_default (yypact[yystate]);
|
return yyis_pact_ninf (yypact[yystate]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The default reduction for STATE, assuming it has one. */
|
/** The default reduction for STATE, assuming it has one. */
|
||||||
@@ -1031,8 +1033,10 @@ yydefaultAction (yyStateNum yystate)
|
|||||||
return yydefact[yystate];
|
return yydefact[yystate];
|
||||||
}
|
}
|
||||||
|
|
||||||
#define yytable_value_is_error(yytable_value) \
|
#define yyis_table_ninf(yytable_value) \
|
||||||
]b4_table_value_equals([[table]], [[yytable_value]], [b4_table_ninf])[
|
]m4_if(m4_eval(b4_table_ninf < b4_table_min), [1],
|
||||||
|
[YYID (0)],
|
||||||
|
[((yytable_value) == YYTABLE_NINF)])[
|
||||||
|
|
||||||
/** Set *YYACTION to the action to take in YYSTATE on seeing YYTOKEN.
|
/** Set *YYACTION to the action to take in YYSTATE on seeing YYTOKEN.
|
||||||
* Result R means
|
* Result R means
|
||||||
@@ -1047,13 +1051,12 @@ yygetLRActions (yyStateNum yystate, int yytoken,
|
|||||||
int* yyaction, const short int** yyconflicts)
|
int* yyaction, const short int** yyconflicts)
|
||||||
{
|
{
|
||||||
int yyindex = yypact[yystate] + yytoken;
|
int yyindex = yypact[yystate] + yytoken;
|
||||||
if (yypact_value_is_default (yypact[yystate])
|
if (yyindex < 0 || YYLAST < yyindex || yycheck[yyindex] != yytoken)
|
||||||
|| yyindex < 0 || YYLAST < yyindex || yycheck[yyindex] != yytoken)
|
|
||||||
{
|
{
|
||||||
*yyaction = -yydefact[yystate];
|
*yyaction = -yydefact[yystate];
|
||||||
*yyconflicts = yyconfl;
|
*yyconflicts = yyconfl;
|
||||||
}
|
}
|
||||||
else if (! yytable_value_is_error (yytable[yyindex]))
|
else if (! yyis_table_ninf (yytable[yyindex]))
|
||||||
{
|
{
|
||||||
*yyaction = yytable[yyindex];
|
*yyaction = yytable[yyindex];
|
||||||
*yyconflicts = yyconfl + yyconflp[yyindex];
|
*yyconflicts = yyconfl + yyconflp[yyindex];
|
||||||
@@ -1802,7 +1805,7 @@ yyreportAmbiguity (yySemanticOption* yyx0,
|
|||||||
|
|
||||||
yyerror (]b4_yyerror_args[YY_("syntax is ambiguous"));
|
yyerror (]b4_yyerror_args[YY_("syntax is ambiguous"));
|
||||||
return yyabort;
|
return yyabort;
|
||||||
}]b4_locations_if([[
|
}
|
||||||
|
|
||||||
/** Starting at and including state S1, resolve the location for each of the
|
/** Starting at and including state S1, resolve the location for each of the
|
||||||
* previous N1 states that is unresolved. The first semantic option of a state
|
* previous N1 states that is unresolved. The first semantic option of a state
|
||||||
@@ -1860,7 +1863,7 @@ yyresolveLocations (yyGLRState* yys1, int yyn1,
|
|||||||
yylloc = yylloc_current;
|
yylloc = yylloc_current;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}]])[
|
}
|
||||||
|
|
||||||
/** Resolve the ambiguity represented in state S, perform the indicated
|
/** Resolve the ambiguity represented in state S, perform the indicated
|
||||||
* actions, and set the semantic value of S. If result != yyok, the chain of
|
* actions, and set the semantic value of S. If result != yyok, the chain of
|
||||||
@@ -1894,8 +1897,8 @@ yyresolveValue (yyGLRState* yys, yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
{
|
{
|
||||||
switch (yypreference (yybest, yyp))
|
switch (yypreference (yybest, yyp))
|
||||||
{
|
{
|
||||||
case 0:]b4_locations_if([[
|
case 0:
|
||||||
yyresolveLocations (yys, 1, yystackp]b4_user_args[);]])[
|
yyresolveLocations (yys, 1, yystackp]b4_user_args[);
|
||||||
return yyreportAmbiguity (yybest, yyp]b4_pure_args[);
|
return yyreportAmbiguity (yybest, yyp]b4_pure_args[);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
@@ -2088,130 +2091,102 @@ yyprocessOneStack (yyGLRStack* yystackp, size_t yyk,
|
|||||||
/*ARGSUSED*/ static void
|
/*ARGSUSED*/ static void
|
||||||
yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
||||||
{
|
{
|
||||||
if (yystackp->yyerrState != 0)
|
if (yystackp->yyerrState == 0)
|
||||||
return;
|
|
||||||
#if ! YYERROR_VERBOSE
|
|
||||||
yyerror (]b4_lyyerror_args[YY_("syntax error"));
|
|
||||||
#else
|
|
||||||
yySymbol yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
|
|
||||||
size_t yysize0 = yytnamerr (NULL, yytokenName (yytoken));
|
|
||||||
size_t yysize = yysize0;
|
|
||||||
size_t yysize1;
|
|
||||||
yybool yysize_overflow = yyfalse;
|
|
||||||
char* yymsg = NULL;
|
|
||||||
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
|
||||||
/* Internationalized format string. */
|
|
||||||
const char *yyformat = 0;
|
|
||||||
/* Arguments of yyformat. */
|
|
||||||
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
|
|
||||||
/* Number of reported tokens (one for the "unexpected", one per
|
|
||||||
"expected"). */
|
|
||||||
int yycount = 0;
|
|
||||||
|
|
||||||
/* There are many possibilities here to consider:
|
|
||||||
- If this state is a consistent state with a default action, then
|
|
||||||
the only way this function was invoked is if the default action
|
|
||||||
is an error action. In that case, don't check for expected
|
|
||||||
tokens because there are none.
|
|
||||||
- The only way there can be no lookahead present (in yychar) is if
|
|
||||||
this state is a consistent state with a default action. Thus,
|
|
||||||
detecting the absence of a lookahead is sufficient to determine
|
|
||||||
that there is no unexpected or expected token to report. In that
|
|
||||||
case, just report a simple "syntax error".
|
|
||||||
- Don't assume there isn't a lookahead just because this state is a
|
|
||||||
consistent state with a default action. There might have been a
|
|
||||||
previous inconsistent state, consistent state with a non-default
|
|
||||||
action, or user semantic action that manipulated yychar.
|
|
||||||
- Of course, the expected token list depends on states to have
|
|
||||||
correct lookahead information, and it depends on the parser not
|
|
||||||
to perform extra reductions after fetching a lookahead from the
|
|
||||||
scanner and before detecting a syntax error. Thus, state merging
|
|
||||||
(from LALR or IELR) and default reductions corrupt the expected
|
|
||||||
token list. However, the list is correct for canonical LR with
|
|
||||||
one exception: it will still contain any token that will not be
|
|
||||||
accepted due to an error action in a later state.
|
|
||||||
*/
|
|
||||||
if (yytoken != YYEMPTY)
|
|
||||||
{
|
{
|
||||||
int yyn = yypact[yystackp->yytops.yystates[0]->yylrState];
|
#if YYERROR_VERBOSE
|
||||||
yyarg[yycount++] = yytokenName (yytoken);
|
int yyn;
|
||||||
if (!yypact_value_is_default (yyn))
|
yyn = yypact[yystackp->yytops.yystates[0]->yylrState];
|
||||||
{
|
if (YYPACT_NINF < yyn && yyn <= YYLAST)
|
||||||
/* Start YYX at -YYN if negative to avoid negative indexes in
|
{
|
||||||
YYCHECK. In other words, skip the first -YYN actions for this
|
yySymbol yytoken = YYTRANSLATE (yychar);
|
||||||
state because they are default actions. */
|
size_t yysize0 = yytnamerr (NULL, yytokenName (yytoken));
|
||||||
int yyxbegin = yyn < 0 ? -yyn : 0;
|
size_t yysize = yysize0;
|
||||||
/* Stay within bounds of both yycheck and yytname. */
|
size_t yysize1;
|
||||||
int yychecklim = YYLAST - yyn + 1;
|
yybool yysize_overflow = yyfalse;
|
||||||
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
|
char* yymsg = NULL;
|
||||||
int yyx;
|
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
||||||
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
|
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
|
||||||
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
|
int yyx;
|
||||||
&& !yytable_value_is_error (yytable[yyx + yyn]))
|
char *yyfmt;
|
||||||
{
|
char const *yyf;
|
||||||
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
|
static char const yyunexpected[] = "syntax error, unexpected %s";
|
||||||
{
|
static char const yyexpecting[] = ", expecting %s";
|
||||||
yycount = 1;
|
static char const yyor[] = " or %s";
|
||||||
yysize = yysize0;
|
char yyformat[sizeof yyunexpected
|
||||||
break;
|
+ sizeof yyexpecting - 1
|
||||||
}
|
+ ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
|
||||||
yyarg[yycount++] = yytokenName (yyx);
|
* (sizeof yyor - 1))];
|
||||||
yysize1 = yysize + yytnamerr (NULL, yytokenName (yyx));
|
char const *yyprefix = yyexpecting;
|
||||||
yysize_overflow |= yysize1 < yysize;
|
|
||||||
yysize = yysize1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (yycount)
|
/* Start YYX at -YYN if negative to avoid negative indexes in
|
||||||
{
|
YYCHECK. */
|
||||||
#define YYCASE_(N, S) \
|
int yyxbegin = yyn < 0 ? -yyn : 0;
|
||||||
case N: \
|
|
||||||
yyformat = S; \
|
|
||||||
break
|
|
||||||
YYCASE_(0, YY_("syntax error"));
|
|
||||||
YYCASE_(1, YY_("syntax error, unexpected %s"));
|
|
||||||
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
|
|
||||||
YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
|
|
||||||
YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
|
|
||||||
YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
|
|
||||||
#undef YYCASE_
|
|
||||||
}
|
|
||||||
|
|
||||||
yysize1 = yysize + strlen (yyformat);
|
/* Stay within bounds of both yycheck and yytname. */
|
||||||
yysize_overflow |= yysize1 < yysize;
|
int yychecklim = YYLAST - yyn + 1;
|
||||||
yysize = yysize1;
|
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
|
||||||
|
int yycount = 1;
|
||||||
|
|
||||||
if (!yysize_overflow)
|
yyarg[0] = yytokenName (yytoken);
|
||||||
yymsg = (char *) YYMALLOC (yysize);
|
yyfmt = yystpcpy (yyformat, yyunexpected);
|
||||||
|
|
||||||
if (yymsg)
|
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
|
||||||
{
|
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
|
||||||
char *yyp = yymsg;
|
{
|
||||||
int yyi = 0;
|
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
|
||||||
while ((*yyp = *yyformat))
|
{
|
||||||
{
|
yycount = 1;
|
||||||
if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
|
yysize = yysize0;
|
||||||
{
|
yyformat[sizeof yyunexpected - 1] = '\0';
|
||||||
yyp += yytnamerr (yyp, yyarg[yyi++]);
|
break;
|
||||||
yyformat += 2;
|
}
|
||||||
}
|
yyarg[yycount++] = yytokenName (yyx);
|
||||||
else
|
yysize1 = yysize + yytnamerr (NULL, yytokenName (yyx));
|
||||||
{
|
yysize_overflow |= yysize1 < yysize;
|
||||||
yyp++;
|
yysize = yysize1;
|
||||||
yyformat++;
|
yyfmt = yystpcpy (yyfmt, yyprefix);
|
||||||
}
|
yyprefix = yyor;
|
||||||
}
|
}
|
||||||
yyerror (]b4_lyyerror_args[yymsg);
|
|
||||||
YYFREE (yymsg);
|
yyf = YY_(yyformat);
|
||||||
}
|
yysize1 = yysize + strlen (yyf);
|
||||||
else
|
yysize_overflow |= yysize1 < yysize;
|
||||||
{
|
yysize = yysize1;
|
||||||
yyerror (]b4_lyyerror_args[YY_("syntax error"));
|
|
||||||
yyMemoryExhausted (yystackp);
|
if (!yysize_overflow)
|
||||||
}
|
yymsg = (char *) YYMALLOC (yysize);
|
||||||
|
|
||||||
|
if (yymsg)
|
||||||
|
{
|
||||||
|
char *yyp = yymsg;
|
||||||
|
int yyi = 0;
|
||||||
|
while ((*yyp = *yyf))
|
||||||
|
{
|
||||||
|
if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
|
||||||
|
{
|
||||||
|
yyp += yytnamerr (yyp, yyarg[yyi++]);
|
||||||
|
yyf += 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
yyp++;
|
||||||
|
yyf++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
yyerror (]b4_lyyerror_args[yymsg);
|
||||||
|
YYFREE (yymsg);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
yyerror (]b4_lyyerror_args[YY_("syntax error"));
|
||||||
|
yyMemoryExhausted (yystackp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
#endif /* YYERROR_VERBOSE */
|
#endif /* YYERROR_VERBOSE */
|
||||||
yynerrs += 1;
|
yyerror (]b4_lyyerror_args[YY_("syntax error"));
|
||||||
|
yynerrs += 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Recover from a syntax error on *YYSTACKP, assuming that *YYSTACKP->YYTOKENP,
|
/* Recover from a syntax error on *YYSTACKP, assuming that *YYSTACKP->YYTOKENP,
|
||||||
@@ -2257,7 +2232,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
|
YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
|
||||||
}
|
}
|
||||||
yyj = yypact[yystackp->yytops.yystates[0]->yylrState];
|
yyj = yypact[yystackp->yytops.yystates[0]->yylrState];
|
||||||
if (yypact_value_is_default (yyj))
|
if (yyis_pact_ninf (yyj))
|
||||||
return;
|
return;
|
||||||
yyj += yytoken;
|
yyj += yytoken;
|
||||||
if (yyj < 0 || YYLAST < yyj || yycheck[yyj] != yytoken)
|
if (yyj < 0 || YYLAST < yyj || yycheck[yyj] != yytoken)
|
||||||
@@ -2265,7 +2240,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
if (yydefact[yystackp->yytops.yystates[0]->yylrState] != 0)
|
if (yydefact[yystackp->yytops.yystates[0]->yylrState] != 0)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (! yytable_value_is_error (yytable[yyj]))
|
else if (yytable[yyj] != 0 && ! yyis_table_ninf (yytable[yyj]))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2286,7 +2261,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
{
|
{
|
||||||
yyGLRState *yys = yystackp->yytops.yystates[0];
|
yyGLRState *yys = yystackp->yytops.yystates[0];
|
||||||
yyj = yypact[yys->yylrState];
|
yyj = yypact[yys->yylrState];
|
||||||
if (! yypact_value_is_default (yyj))
|
if (! yyis_pact_ninf (yyj))
|
||||||
{
|
{
|
||||||
yyj += YYTERROR;
|
yyj += YYTERROR;
|
||||||
if (0 <= yyj && yyj <= YYLAST && yycheck[yyj] == YYTERROR
|
if (0 <= yyj && yyj <= YYLAST && yycheck[yyj] == YYTERROR
|
||||||
@@ -2348,7 +2323,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
yychar = YYEMPTY;
|
yychar = YYEMPTY;
|
||||||
yylval = yyval_default;
|
yylval = yyval_default;
|
||||||
]b4_locations_if([
|
]b4_locations_if([
|
||||||
#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
|
#if YYLTYPE_IS_TRIVIAL
|
||||||
yylloc.first_line = yylloc.last_line = ]b4_location_initial_line[;
|
yylloc.first_line = yylloc.last_line = ]b4_location_initial_line[;
|
||||||
yylloc.first_column = yylloc.last_column = ]b4_location_initial_column[;
|
yylloc.first_column = yylloc.last_column = ]b4_location_initial_column[;
|
||||||
#endif
|
#endif
|
||||||
@@ -2662,17 +2637,17 @@ dnl glr.cc produces its own header.
|
|||||||
dnl
|
dnl
|
||||||
m4_if(b4_skeleton, ["glr.c"],
|
m4_if(b4_skeleton, ["glr.c"],
|
||||||
[b4_defines_if(
|
[b4_defines_if(
|
||||||
[@output(b4_spec_defines_file@)@
|
[@output(b4_spec_defines_file@)
|
||||||
b4_copyright([Skeleton interface for Bison GLR parsers in C],
|
b4_copyright([Skeleton interface for Bison GLR parsers in C],
|
||||||
[2002-2011])
|
[2002, 2003, 2004, 2005, 2006])
|
||||||
|
|
||||||
b4_shared_declarations
|
b4_shared_declarations
|
||||||
|
|
||||||
b4_pure_if([],
|
b4_pure_if([],
|
||||||
[[extern YYSTYPE ]b4_prefix[lval;]])
|
[[extern YYSTYPE b4_prefix][lval;]])
|
||||||
|
|
||||||
b4_locations_if([b4_pure_if([],
|
b4_locations_if([b4_pure_if([],
|
||||||
[extern YYLTYPE ]b4_prefix[lloc;])
|
[extern YYLTYPE b4_prefix[]lloc;])
|
||||||
])
|
])
|
||||||
])])
|
])])
|
||||||
m4_divert_pop(0)
|
m4_divert_pop(0)
|
||||||
|
|||||||
+13
-10
@@ -1,8 +1,8 @@
|
|||||||
-*- C -*-
|
-*- C -*-
|
||||||
|
|
||||||
# C++ GLR skeleton for Bison
|
# C++ GLR skeleton for Bison
|
||||||
|
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation,
|
||||||
# Copyright (C) 2002-2011 Free Software Foundation, Inc.
|
# Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -54,8 +54,7 @@ b4_defines_if([],
|
|||||||
[b4_fatal([b4_skeleton[: using %%defines is mandatory]])])
|
[b4_fatal([b4_skeleton[: using %%defines is mandatory]])])
|
||||||
|
|
||||||
m4_include(b4_pkgdatadir/[c++.m4])
|
m4_include(b4_pkgdatadir/[c++.m4])
|
||||||
b4_percent_define_ifdef([[location_type]], [],
|
m4_include(b4_pkgdatadir/[location.cc])
|
||||||
[m4_include(b4_pkgdatadir/[location.cc])])
|
|
||||||
|
|
||||||
m4_define([b4_parser_class_name],
|
m4_define([b4_parser_class_name],
|
||||||
[b4_percent_define_get([[parser_class_name]])])
|
[b4_percent_define_get([[parser_class_name]])])
|
||||||
@@ -218,9 +217,9 @@ m4_include(b4_pkgdatadir/[glr.c])
|
|||||||
m4_popdef([b4_parse_param])
|
m4_popdef([b4_parse_param])
|
||||||
|
|
||||||
m4_divert_push(0)
|
m4_divert_push(0)
|
||||||
@output(b4_spec_defines_file@)@
|
@output(b4_spec_defines_file@)
|
||||||
b4_copyright([Skeleton interface for Bison GLR parsers in C++],
|
b4_copyright([Skeleton interface for Bison GLR parsers in C++],
|
||||||
[2002-2006, 2009-2011])[
|
[2002, 2003, 2004, 2005, 2006])[
|
||||||
|
|
||||||
/* C++ GLR parser skeleton written by Akim Demaille. */
|
/* C++ GLR parser skeleton written by Akim Demaille. */
|
||||||
|
|
||||||
@@ -231,12 +230,17 @@ b4_copyright([Skeleton interface for Bison GLR parsers in C++],
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
]b4_percent_define_ifdef([[location_type]], [],
|
|
||||||
[[#include "location.hh"]])[
|
|
||||||
|
|
||||||
/* Using locations. */
|
/* Using locations. */
|
||||||
#define YYLSP_NEEDED ]b4_locations_flag[
|
#define YYLSP_NEEDED ]b4_locations_flag[
|
||||||
|
|
||||||
|
]b4_namespace_open[
|
||||||
|
class position;
|
||||||
|
class location;
|
||||||
|
]b4_namespace_close[
|
||||||
|
|
||||||
|
#include "location.hh"
|
||||||
|
|
||||||
/* Enabling traces. */
|
/* Enabling traces. */
|
||||||
#ifndef YYDEBUG
|
#ifndef YYDEBUG
|
||||||
# define YYDEBUG ]b4_debug_flag[
|
# define YYDEBUG ]b4_debug_flag[
|
||||||
@@ -280,8 +284,7 @@ b4_user_stype
|
|||||||
typedef YYSTYPE semantic_type;
|
typedef YYSTYPE semantic_type;
|
||||||
#endif
|
#endif
|
||||||
/// Symbol locations.
|
/// Symbol locations.
|
||||||
typedef ]b4_percent_define_get([[location_type]],
|
typedef ]b4_percent_define_get([[location_type]])[ location_type;
|
||||||
[[location]])[ location_type;
|
|
||||||
/// Tokens.
|
/// Tokens.
|
||||||
struct token
|
struct token
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-2
@@ -1,8 +1,7 @@
|
|||||||
-*- Autoconf -*-
|
-*- Autoconf -*-
|
||||||
|
|
||||||
# Java skeleton dispatching for Bison.
|
# Java skeleton dispatching for Bison.
|
||||||
|
# Copyright (C) 2007 Free Software Foundation, Inc.
|
||||||
# Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+10
-40
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Java language support for Bison
|
# Java language support for Bison
|
||||||
|
|
||||||
# Copyright (C) 2007-2011 Free Software Foundation, Inc.
|
# Copyright (C) 2007 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -25,23 +25,6 @@ m4_define([b4_comment], [/* m4_bpatsubst([$1], [
|
|||||||
]) */])
|
]) */])
|
||||||
|
|
||||||
|
|
||||||
# b4_list2(LIST1, LIST2)
|
|
||||||
# --------------------------
|
|
||||||
# Join two lists with a comma if necessary.
|
|
||||||
m4_define([b4_list2],
|
|
||||||
[$1[]m4_ifval(m4_quote($1), [m4_ifval(m4_quote($2), [[, ]])])[]$2])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_percent_define_get3(DEF, PRE, POST, NOT)
|
|
||||||
# -------------------------------------------
|
|
||||||
# Expand to the value of DEF surrounded by PRE and POST if it's %define'ed,
|
|
||||||
# otherwise NOT.
|
|
||||||
m4_define([b4_percent_define_get3],
|
|
||||||
[m4_ifval(m4_quote(b4_percent_define_get([$1])),
|
|
||||||
[$2[]b4_percent_define_get([$1])[]$3], [$4])])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# b4_flag_value(BOOLEAN-FLAG)
|
# b4_flag_value(BOOLEAN-FLAG)
|
||||||
# ---------------------------
|
# ---------------------------
|
||||||
m4_define([b4_flag_value], [b4_flag_if([$1], [true], [false])])
|
m4_define([b4_flag_value], [b4_flag_if([$1], [true], [false])])
|
||||||
@@ -61,20 +44,6 @@ m4_define([b4_abstract_if],
|
|||||||
[b4_percent_define_flag_if([abstract], [$1], [$2])])
|
[b4_percent_define_flag_if([abstract], [$1], [$2])])
|
||||||
|
|
||||||
|
|
||||||
# b4_final_if(TRUE, FALSE)
|
|
||||||
# ---------------------------
|
|
||||||
b4_percent_define_default([[final]], [[false]])
|
|
||||||
m4_define([b4_final_if],
|
|
||||||
[b4_percent_define_flag_if([final], [$1], [$2])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_strictfp_if(TRUE, FALSE)
|
|
||||||
# ---------------------------
|
|
||||||
b4_percent_define_default([[strictfp]], [[false]])
|
|
||||||
m4_define([b4_strictfp_if],
|
|
||||||
[b4_percent_define_flag_if([strictfp], [$1], [$2])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_lexer_if(TRUE, FALSE)
|
# b4_lexer_if(TRUE, FALSE)
|
||||||
# ------------------------
|
# ------------------------
|
||||||
m4_define([b4_lexer_if],
|
m4_define([b4_lexer_if],
|
||||||
@@ -84,7 +53,10 @@ m4_define([b4_lexer_if],
|
|||||||
# b4_identification
|
# b4_identification
|
||||||
# -----------------
|
# -----------------
|
||||||
m4_define([b4_identification],
|
m4_define([b4_identification],
|
||||||
[ /** Version number for the Bison executable that generated this parser. */
|
[/** Always <tt>true</tt>, identifies Bison output. */
|
||||||
|
public static final boolean bison = true;
|
||||||
|
|
||||||
|
/** Version number for the Bison executable that generated this parser. */
|
||||||
public static final String bisonVersion = "b4_version";
|
public static final String bisonVersion = "b4_version";
|
||||||
|
|
||||||
/** Name of the skeleton that generated this parser. */
|
/** Name of the skeleton that generated this parser. */
|
||||||
@@ -103,7 +75,7 @@ m4_define([b4_identification],
|
|||||||
m4_define([b4_int_type],
|
m4_define([b4_int_type],
|
||||||
[m4_if(b4_ints_in($@, [-128], [127]), [1], [byte],
|
[m4_if(b4_ints_in($@, [-128], [127]), [1], [byte],
|
||||||
b4_ints_in($@, [-32768], [32767]), [1], [short],
|
b4_ints_in($@, [-32768], [32767]), [1], [short],
|
||||||
[int])])
|
[int])])
|
||||||
|
|
||||||
# b4_int_type_for(NAME)
|
# b4_int_type_for(NAME)
|
||||||
# ---------------------
|
# ---------------------
|
||||||
@@ -134,7 +106,7 @@ m4_define([b4_token_enum],
|
|||||||
# -----------------------------------------------------
|
# -----------------------------------------------------
|
||||||
# Output the definition of the tokens (if there are) as enums.
|
# Output the definition of the tokens (if there are) as enums.
|
||||||
m4_define([b4_token_enums],
|
m4_define([b4_token_enums],
|
||||||
[m4_if([$#$1], [1], [],
|
[m4_if([$@], [[]], [],
|
||||||
[/* Tokens. */
|
[/* Tokens. */
|
||||||
m4_map([b4_token_enum], [$@])])
|
m4_map([b4_token_enum], [$@])])
|
||||||
])
|
])
|
||||||
@@ -156,16 +128,14 @@ m4_define([b4_case], [ case $1:
|
|||||||
m4_define([b4_yystype], [b4_percent_define_get([[stype]])])
|
m4_define([b4_yystype], [b4_percent_define_get([[stype]])])
|
||||||
b4_percent_define_default([[stype]], [[Object]])])
|
b4_percent_define_default([[stype]], [[Object]])])
|
||||||
|
|
||||||
# %name-prefix
|
m4_define_default([[b4_prefix]], [[YY]])])
|
||||||
m4_define_default([b4_prefix], [[YY]])
|
|
||||||
|
|
||||||
b4_percent_define_default([[parser_class_name]], [b4_prefix[]Parser])])
|
b4_percent_define_default([[parser_class_name]], [b4_prefix[]Parser])])
|
||||||
m4_define([b4_parser_class_name], [b4_percent_define_get([[parser_class_name]])])
|
m4_define([b4_parser_class_name], [b4_percent_define_get([[parser_class_name]])])
|
||||||
|
|
||||||
b4_percent_define_default([[lex_throws]], [[java.io.IOException]])])
|
b4_percent_define_default([[lex_throws]], [[java.io.IOException]])])
|
||||||
m4_define([b4_lex_throws], [b4_percent_define_get([[lex_throws]])])
|
m4_define([b4_lex_throws], [b4_percent_define_get([[lex_throws]])])
|
||||||
|
|
||||||
b4_percent_define_default([[throws]], [])])
|
b4_percent_define_default([[throws]], [b4_lex_throws])])
|
||||||
m4_define([b4_throws], [b4_percent_define_get([[throws]])])
|
m4_define([b4_throws], [b4_percent_define_get([[throws]])])
|
||||||
|
|
||||||
b4_percent_define_default([[location_type]], [Location])])
|
b4_percent_define_default([[location_type]], [Location])])
|
||||||
@@ -235,7 +205,7 @@ m4_define([b4_param_decls],
|
|||||||
[m4_map([b4_param_decl], [$@])])
|
[m4_map([b4_param_decl], [$@])])
|
||||||
m4_define([b4_param_decl], [, $1])
|
m4_define([b4_param_decl], [, $1])
|
||||||
|
|
||||||
m4_define([b4_remove_comma], [m4_ifval(m4_quote($1), [$1, ], [])m4_shift2($@)])
|
m4_define([b4_remove_comma], [m4_ifval($1, [$1, ], [])m4_shiftn(2, $@)])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+113
-203
@@ -1,6 +1,7 @@
|
|||||||
# C++ skeleton for Bison
|
# C++ skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 2002-2011 Free Software Foundation, Inc.
|
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation,
|
||||||
|
# Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -24,18 +25,17 @@ m4_define([b4_parser_class_name],
|
|||||||
b4_defines_if([],
|
b4_defines_if([],
|
||||||
[b4_fatal([b4_skeleton[: using %%defines is mandatory]])])
|
[b4_fatal([b4_skeleton[: using %%defines is mandatory]])])
|
||||||
|
|
||||||
b4_percent_define_ifdef([[location_type]], [],
|
# Backward compatibility.
|
||||||
[# Backward compatibility.
|
m4_define([b4_location_constructors])
|
||||||
m4_define([b4_location_constructors])
|
m4_include(b4_pkgdatadir/[location.cc])
|
||||||
m4_include(b4_pkgdatadir/[location.cc])])
|
|
||||||
|
|
||||||
# We do want M4 expansion after # for CPP macros.
|
# We do want M4 expansion after # for CPP macros.
|
||||||
m4_changecom()
|
m4_changecom()
|
||||||
m4_divert_push(0)dnl
|
m4_divert_push(0)dnl
|
||||||
b4_defines_if(
|
b4_defines_if(
|
||||||
[@output(b4_spec_defines_file@)@
|
[@output(b4_spec_defines_file@)
|
||||||
b4_copyright([Skeleton interface for Bison LALR(1) parsers in C++],
|
b4_copyright([Skeleton interface for Bison LALR(1) parsers in C++],
|
||||||
[2002-2011])
|
[2002, 2003, 2004, 2005, 2006])
|
||||||
dnl FIXME: This is wrong, we want computed header guards.
|
dnl FIXME: This is wrong, we want computed header guards.
|
||||||
[
|
[
|
||||||
/* C++ LALR(1) parser skeleton written by Akim Demaille. */
|
/* C++ LALR(1) parser skeleton written by Akim Demaille. */
|
||||||
@@ -48,8 +48,13 @@ dnl FIXME: This is wrong, we want computed header guards.
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "stack.hh"
|
#include "stack.hh"
|
||||||
]b4_percent_define_ifdef([[location_type]], [],
|
|
||||||
[[#include "location.hh"]])[
|
]b4_namespace_open[
|
||||||
|
class position;
|
||||||
|
class location;
|
||||||
|
]b4_namespace_close[
|
||||||
|
|
||||||
|
#include "location.hh"
|
||||||
|
|
||||||
/* Enabling traces. */
|
/* Enabling traces. */
|
||||||
#ifndef YYDEBUG
|
#ifndef YYDEBUG
|
||||||
@@ -69,6 +74,25 @@ dnl FIXME: This is wrong, we want computed header guards.
|
|||||||
# define YYTOKEN_TABLE ]b4_token_table[
|
# define YYTOKEN_TABLE ]b4_token_table[
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
|
||||||
|
If N is 0, then set CURRENT to the empty location which ends
|
||||||
|
the previous symbol: RHS[0] (always defined). */
|
||||||
|
|
||||||
|
#ifndef YYLLOC_DEFAULT
|
||||||
|
# define YYLLOC_DEFAULT(Current, Rhs, N) \
|
||||||
|
do { \
|
||||||
|
if (N) \
|
||||||
|
{ \
|
||||||
|
(Current).begin = (Rhs)[1].begin; \
|
||||||
|
(Current).end = (Rhs)[N].end; \
|
||||||
|
} \
|
||||||
|
else \
|
||||||
|
{ \
|
||||||
|
(Current).begin = (Current).end = (Rhs)[0].end; \
|
||||||
|
} \
|
||||||
|
} while (false)
|
||||||
|
#endif
|
||||||
|
|
||||||
]b4_namespace_open[
|
]b4_namespace_open[
|
||||||
|
|
||||||
/// A Bison parser.
|
/// A Bison parser.
|
||||||
@@ -89,8 +113,7 @@ b4_user_stype
|
|||||||
typedef YYSTYPE semantic_type;
|
typedef YYSTYPE semantic_type;
|
||||||
#endif
|
#endif
|
||||||
/// Symbol locations.
|
/// Symbol locations.
|
||||||
typedef ]b4_percent_define_get([[location_type]],
|
typedef ]b4_percent_define_get([[location_type]])[ location_type;
|
||||||
[[location]])[ location_type;
|
|
||||||
/// Tokens.
|
/// Tokens.
|
||||||
struct token
|
struct token
|
||||||
{
|
{
|
||||||
@@ -107,7 +130,6 @@ b4_user_stype
|
|||||||
/// \returns 0 iff parsing succeeded.
|
/// \returns 0 iff parsing succeeded.
|
||||||
virtual int parse ();
|
virtual int parse ();
|
||||||
|
|
||||||
#if YYDEBUG
|
|
||||||
/// The current debugging stream.
|
/// The current debugging stream.
|
||||||
std::ostream& debug_stream () const;
|
std::ostream& debug_stream () const;
|
||||||
/// Set the current debugging stream.
|
/// Set the current debugging stream.
|
||||||
@@ -119,7 +141,6 @@ b4_user_stype
|
|||||||
debug_level_type debug_level () const;
|
debug_level_type debug_level () const;
|
||||||
/// Set the current debugging level.
|
/// Set the current debugging level.
|
||||||
void set_debug_level (debug_level_type l);
|
void set_debug_level (debug_level_type l);
|
||||||
#endif
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Report a syntax error.
|
/// Report a syntax error.
|
||||||
@@ -130,7 +151,8 @@ b4_user_stype
|
|||||||
/// Generate an error message.
|
/// Generate an error message.
|
||||||
/// \param state the state where the error occurred.
|
/// \param state the state where the error occurred.
|
||||||
/// \param tok the lookahead token.
|
/// \param tok the lookahead token.
|
||||||
virtual std::string yysyntax_error_ (int yystate, int tok);
|
virtual std::string yysyntax_error_ (int yystate]dnl
|
||||||
|
b4_error_verbose_if([, int tok])[);
|
||||||
|
|
||||||
#if YYDEBUG
|
#if YYDEBUG
|
||||||
/// \brief Report a symbol value on the debug stream.
|
/// \brief Report a symbol value on the debug stream.
|
||||||
@@ -166,14 +188,6 @@ b4_user_stype
|
|||||||
/// The location stack.
|
/// The location stack.
|
||||||
location_stack_type yylocation_stack_;
|
location_stack_type yylocation_stack_;
|
||||||
|
|
||||||
/// Whether the given \c yypact_ value indicates a defaulted state.
|
|
||||||
/// \param yyvalue the value to check
|
|
||||||
static bool yy_pact_value_is_default_ (int yyvalue);
|
|
||||||
|
|
||||||
/// Whether the given \c yytable_ value indicates a syntax error.
|
|
||||||
/// \param yyvalue the value to check
|
|
||||||
static bool yy_table_value_is_error_ (int yyvalue);
|
|
||||||
|
|
||||||
/// Internal symbol numbers.
|
/// Internal symbol numbers.
|
||||||
typedef ]b4_int_type_for([b4_translate])[ token_number_type;
|
typedef ]b4_int_type_for([b4_translate])[ token_number_type;
|
||||||
/* Tables. */
|
/* Tables. */
|
||||||
@@ -181,7 +195,7 @@ b4_user_stype
|
|||||||
static const ]b4_int_type_for([b4_pact])[ yypact_[];
|
static const ]b4_int_type_for([b4_pact])[ yypact_[];
|
||||||
static const ]b4_int_type(b4_pact_ninf, b4_pact_ninf)[ yypact_ninf_;
|
static const ]b4_int_type(b4_pact_ninf, b4_pact_ninf)[ yypact_ninf_;
|
||||||
|
|
||||||
/// For a state, default reduction number.
|
/// For a state, default rule to reduce.
|
||||||
/// Unless\a yytable_ specifies something else to do.
|
/// Unless\a yytable_ specifies something else to do.
|
||||||
/// Zero means the default is an error.
|
/// Zero means the default is an error.
|
||||||
static const ]b4_int_type_for([b4_defact])[ yydefact_[];
|
static const ]b4_int_type_for([b4_defact])[ yydefact_[];
|
||||||
@@ -210,10 +224,12 @@ b4_user_stype
|
|||||||
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
|
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
|
||||||
/// For a symbol, its name in clear.
|
/// For a symbol, its name in clear.
|
||||||
static const char* const yytname_[];
|
static const char* const yytname_[];
|
||||||
#endif]b4_error_verbose_if([
|
#endif
|
||||||
|
|
||||||
|
#if YYERROR_VERBOSE
|
||||||
/// Convert the symbol name \a n to a form suitable for a diagnostic.
|
/// Convert the symbol name \a n to a form suitable for a diagnostic.
|
||||||
static std::string yytnamerr_ (const char *n);])[
|
virtual std::string yytnamerr_ (const char *n);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if YYDEBUG
|
#if YYDEBUG
|
||||||
/// A type to store symbol numbers and -1.
|
/// A type to store symbol numbers and -1.
|
||||||
@@ -280,9 +296,9 @@ b4_percent_code_get([[provides]])[]dnl
|
|||||||
|
|
||||||
[#endif /* ! defined PARSER_HEADER_H */]
|
[#endif /* ! defined PARSER_HEADER_H */]
|
||||||
])dnl
|
])dnl
|
||||||
@output(b4_parser_file_name@)@
|
@output(b4_parser_file_name@)
|
||||||
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in C++],
|
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in C++],
|
||||||
[2002-2011])
|
[2002, 2003, 2004, 2005, 2006])
|
||||||
b4_percent_code_get([[top]])[]dnl
|
b4_percent_code_get([[top]])[]dnl
|
||||||
m4_if(b4_prefix, [yy], [],
|
m4_if(b4_prefix, [yy], [],
|
||||||
[
|
[
|
||||||
@@ -300,7 +316,7 @@ b4_defines_if([[
|
|||||||
b4_percent_code_get[]dnl
|
b4_percent_code_get[]dnl
|
||||||
|
|
||||||
[#ifndef YY_
|
[#ifndef YY_
|
||||||
# if defined YYENABLE_NLS && YYENABLE_NLS
|
# if YYENABLE_NLS
|
||||||
# if ENABLE_NLS
|
# if ENABLE_NLS
|
||||||
# include <libintl.h> /* FIXME: INFRINGES ON USER NAME SPACE */
|
# include <libintl.h> /* FIXME: INFRINGES ON USER NAME SPACE */
|
||||||
# define YY_(msgid) dgettext ("bison-runtime", msgid)
|
# define YY_(msgid) dgettext ("bison-runtime", msgid)
|
||||||
@@ -311,26 +327,6 @@ b4_percent_code_get[]dnl
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
|
|
||||||
If N is 0, then set CURRENT to the empty location which ends
|
|
||||||
the previous symbol: RHS[0] (always defined). */
|
|
||||||
|
|
||||||
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
|
|
||||||
#ifndef YYLLOC_DEFAULT
|
|
||||||
# define YYLLOC_DEFAULT(Current, Rhs, N) \
|
|
||||||
do \
|
|
||||||
if (N) \
|
|
||||||
{ \
|
|
||||||
(Current).begin = YYRHSLOC (Rhs, 1).begin; \
|
|
||||||
(Current).end = YYRHSLOC (Rhs, N).end; \
|
|
||||||
} \
|
|
||||||
else \
|
|
||||||
{ \
|
|
||||||
(Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end; \
|
|
||||||
} \
|
|
||||||
while (false)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Suppress unused-variable warnings by "using" E. */
|
/* Suppress unused-variable warnings by "using" E. */
|
||||||
#define YYUSE(e) ((void) (e))
|
#define YYUSE(e) ((void) (e))
|
||||||
|
|
||||||
@@ -371,15 +367,12 @@ do { \
|
|||||||
|
|
||||||
#endif /* !YYDEBUG */
|
#endif /* !YYDEBUG */
|
||||||
|
|
||||||
#define yyerrok (yyerrstatus_ = 0)
|
|
||||||
#define yyclearin (yychar = yyempty_)
|
|
||||||
|
|
||||||
#define YYACCEPT goto yyacceptlab
|
#define YYACCEPT goto yyacceptlab
|
||||||
#define YYABORT goto yyabortlab
|
#define YYABORT goto yyabortlab
|
||||||
#define YYERROR goto yyerrorlab
|
#define YYERROR goto yyerrorlab
|
||||||
#define YYRECOVERING() (!!yyerrstatus_)
|
|
||||||
|
|
||||||
]b4_namespace_open[]b4_error_verbose_if([[
|
]b4_namespace_open[
|
||||||
|
#if YYERROR_VERBOSE
|
||||||
|
|
||||||
/* Return YYSTR after stripping away unnecessary quotes and
|
/* Return YYSTR after stripping away unnecessary quotes and
|
||||||
backslashes, so that it's suitable for yyerror. The heuristic is
|
backslashes, so that it's suitable for yyerror. The heuristic is
|
||||||
@@ -417,7 +410,8 @@ do { \
|
|||||||
|
|
||||||
return yystr;
|
return yystr;
|
||||||
}
|
}
|
||||||
]])[
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/// Build a parser object.
|
/// Build a parser object.
|
||||||
]b4_parser_class_name::b4_parser_class_name[ (]b4_parse_param_decl[)]m4_ifset([b4_parse_param], [
|
]b4_parser_class_name::b4_parser_class_name[ (]b4_parse_param_decl[)]m4_ifset([b4_parse_param], [
|
||||||
@@ -518,18 +512,6 @@ do { \
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
inline bool
|
|
||||||
]b4_parser_class_name[::yy_pact_value_is_default_ (int yyvalue)
|
|
||||||
{
|
|
||||||
return yyvalue == yypact_ninf_;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool
|
|
||||||
]b4_parser_class_name[::yy_table_value_is_error_ (int yyvalue)
|
|
||||||
{
|
|
||||||
return yyvalue == yytable_ninf_;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
]b4_parser_class_name[::parse ()
|
]b4_parser_class_name[::parse ()
|
||||||
{
|
{
|
||||||
@@ -551,7 +533,7 @@ do { \
|
|||||||
/// Location of the lookahead.
|
/// Location of the lookahead.
|
||||||
location_type yylloc;
|
location_type yylloc;
|
||||||
/// The locations where the error started and ended.
|
/// The locations where the error started and ended.
|
||||||
location_type yyerror_range[3];
|
location yyerror_range[2];
|
||||||
|
|
||||||
/// $$.
|
/// $$.
|
||||||
semantic_type yyval;
|
semantic_type yyval;
|
||||||
@@ -596,7 +578,7 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
|
|
||||||
/* Try to take a decision without lookahead. */
|
/* Try to take a decision without lookahead. */
|
||||||
yyn = yypact_[yystate];
|
yyn = yypact_[yystate];
|
||||||
if (yy_pact_value_is_default_ (yyn))
|
if (yyn == yypact_ninf_)
|
||||||
goto yydefault;
|
goto yydefault;
|
||||||
|
|
||||||
/* Read a lookahead token. */
|
/* Read a lookahead token. */
|
||||||
@@ -632,8 +614,8 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param))[;
|
|||||||
yyn = yytable_[yyn];
|
yyn = yytable_[yyn];
|
||||||
if (yyn <= 0)
|
if (yyn <= 0)
|
||||||
{
|
{
|
||||||
if (yy_table_value_is_error_ (yyn))
|
if (yyn == 0 || yyn == yytable_ninf_)
|
||||||
goto yyerrlab;
|
goto yyerrlab;
|
||||||
yyn = -yyn;
|
yyn = -yyn;
|
||||||
goto yyreduce;
|
goto yyreduce;
|
||||||
}
|
}
|
||||||
@@ -688,20 +670,8 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param))[;
|
|||||||
switch (yyn)
|
switch (yyn)
|
||||||
{
|
{
|
||||||
]b4_user_actions[
|
]b4_user_actions[
|
||||||
default:
|
default: break;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
/* User semantic actions sometimes alter yychar, and that requires
|
|
||||||
that yytoken be updated with the new translation. We take the
|
|
||||||
approach of translating immediately before every use of yytoken.
|
|
||||||
One alternative is translating here after every semantic action,
|
|
||||||
but that translation would be missed if the semantic action
|
|
||||||
invokes YYABORT, YYACCEPT, or YYERROR immediately after altering
|
|
||||||
yychar. In the case of YYABORT or YYACCEPT, an incorrect
|
|
||||||
destructor might then be invoked immediately. In the case of
|
|
||||||
YYERROR, subsequent parser actions might lead to an incorrect
|
|
||||||
destructor call or verbose syntax error message before the
|
|
||||||
lookahead is translated. */
|
|
||||||
YY_SYMBOL_PRINT ("-> $$ =", yyr1_[yyn], &yyval, &yyloc);
|
YY_SYMBOL_PRINT ("-> $$ =", yyr1_[yyn], &yyval, &yyloc);
|
||||||
|
|
||||||
yypop_ (yylen);
|
yypop_ (yylen);
|
||||||
@@ -725,20 +695,15 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param))[;
|
|||||||
| yyerrlab -- here on detecting error |
|
| yyerrlab -- here on detecting error |
|
||||||
`------------------------------------*/
|
`------------------------------------*/
|
||||||
yyerrlab:
|
yyerrlab:
|
||||||
/* Make sure we have latest lookahead translation. See comments at
|
|
||||||
user semantic actions for why this is necessary. */
|
|
||||||
yytoken = yytranslate_ (yychar);
|
|
||||||
|
|
||||||
/* If not already recovering from an error, report this error. */
|
/* If not already recovering from an error, report this error. */
|
||||||
if (!yyerrstatus_)
|
if (!yyerrstatus_)
|
||||||
{
|
{
|
||||||
++yynerrs_;
|
++yynerrs_;
|
||||||
if (yychar == yyempty_)
|
error (yylloc, yysyntax_error_ (yystate]dnl
|
||||||
yytoken = yyempty_;
|
b4_error_verbose_if([, yytoken])[));
|
||||||
error (yylloc, yysyntax_error_ (yystate, yytoken));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
yyerror_range[1] = yylloc;
|
yyerror_range[0] = yylloc;
|
||||||
if (yyerrstatus_ == 3)
|
if (yyerrstatus_ == 3)
|
||||||
{
|
{
|
||||||
/* If just tried and failed to reuse lookahead token after an
|
/* If just tried and failed to reuse lookahead token after an
|
||||||
@@ -773,7 +738,7 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param))[;
|
|||||||
if (false)
|
if (false)
|
||||||
goto yyerrorlab;
|
goto yyerrorlab;
|
||||||
|
|
||||||
yyerror_range[1] = yylocation_stack_[yylen - 1];
|
yyerror_range[0] = yylocation_stack_[yylen - 1];
|
||||||
/* Do not reclaim the symbols of the rule which action triggered
|
/* Do not reclaim the symbols of the rule which action triggered
|
||||||
this YYERROR. */
|
this YYERROR. */
|
||||||
yypop_ (yylen);
|
yypop_ (yylen);
|
||||||
@@ -790,7 +755,7 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param))[;
|
|||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
yyn = yypact_[yystate];
|
yyn = yypact_[yystate];
|
||||||
if (!yy_pact_value_is_default_ (yyn))
|
if (yyn != yypact_ninf_)
|
||||||
{
|
{
|
||||||
yyn += yyterror_;
|
yyn += yyterror_;
|
||||||
if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_)
|
if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_)
|
||||||
@@ -805,7 +770,7 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param))[;
|
|||||||
if (yystate_stack_.height () == 1)
|
if (yystate_stack_.height () == 1)
|
||||||
YYABORT;
|
YYABORT;
|
||||||
|
|
||||||
yyerror_range[1] = yylocation_stack_[0];
|
yyerror_range[0] = yylocation_stack_[0];
|
||||||
yydestruct_ ("Error: popping",
|
yydestruct_ ("Error: popping",
|
||||||
yystos_[yystate],
|
yystos_[yystate],
|
||||||
&yysemantic_stack_[0], &yylocation_stack_[0]);
|
&yysemantic_stack_[0], &yylocation_stack_[0]);
|
||||||
@@ -814,16 +779,16 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param))[;
|
|||||||
YY_STACK_PRINT ();
|
YY_STACK_PRINT ();
|
||||||
}
|
}
|
||||||
|
|
||||||
yyerror_range[2] = yylloc;
|
yyerror_range[1] = yylloc;
|
||||||
// Using YYLLOC is tempting, but would change the location of
|
// Using YYLLOC is tempting, but would change the location of
|
||||||
// the lookahead. YYLOC is available though.
|
// the lookahead. YYLOC is available though.
|
||||||
YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
|
YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
|
||||||
yysemantic_stack_.push (yylval);
|
yysemantic_stack_.push (yylval);
|
||||||
yylocation_stack_.push (yyloc);
|
yylocation_stack_.push (yyloc);
|
||||||
|
|
||||||
/* Shift the error token. */
|
/* Shift the error token. */
|
||||||
YY_SYMBOL_PRINT ("Shifting", yystos_[yyn],
|
YY_SYMBOL_PRINT ("Shifting", yystos_[yyn],
|
||||||
&yysemantic_stack_[0], &yylocation_stack_[0]);
|
&yysemantic_stack_[0], &yylocation_stack_[0]);
|
||||||
|
|
||||||
yystate = yyn;
|
yystate = yyn;
|
||||||
goto yynewstate;
|
goto yynewstate;
|
||||||
@@ -840,13 +805,7 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param))[;
|
|||||||
|
|
||||||
yyreturn:
|
yyreturn:
|
||||||
if (yychar != yyempty_)
|
if (yychar != yyempty_)
|
||||||
{
|
yydestruct_ ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc);
|
||||||
/* Make sure we have latest lookahead translation. See comments
|
|
||||||
at user semantic actions for why this is necessary. */
|
|
||||||
yytoken = yytranslate_ (yychar);
|
|
||||||
yydestruct_ ("Cleanup: discarding lookahead", yytoken, &yylval,
|
|
||||||
&yylloc);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Do not reclaim the symbols of the rule which action triggered
|
/* Do not reclaim the symbols of the rule which action triggered
|
||||||
this YYABORT or YYACCEPT. */
|
this YYABORT or YYACCEPT. */
|
||||||
@@ -865,100 +824,52 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param))[;
|
|||||||
|
|
||||||
// Generate an error message.
|
// Generate an error message.
|
||||||
std::string
|
std::string
|
||||||
]b4_parser_class_name[::yysyntax_error_ (]dnl
|
]b4_parser_class_name[::yysyntax_error_ (int yystate]dnl
|
||||||
b4_error_verbose_if([int yystate, int yytoken],
|
b4_error_verbose_if([, int tok])[)
|
||||||
[int, int])[)
|
{
|
||||||
{]b4_error_verbose_if([[
|
std::string res;
|
||||||
std::string yyres;
|
YYUSE (yystate);
|
||||||
// Number of reported tokens (one for the "unexpected", one per
|
#if YYERROR_VERBOSE
|
||||||
// "expected").
|
int yyn = yypact_[yystate];
|
||||||
size_t yycount = 0;
|
if (yypact_ninf_ < yyn && yyn <= yylast_)
|
||||||
// Its maximum.
|
|
||||||
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
|
||||||
// Arguments of yyformat.
|
|
||||||
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
|
|
||||||
|
|
||||||
/* There are many possibilities here to consider:
|
|
||||||
- If this state is a consistent state with a default action, then
|
|
||||||
the only way this function was invoked is if the default action
|
|
||||||
is an error action. In that case, don't check for expected
|
|
||||||
tokens because there are none.
|
|
||||||
- The only way there can be no lookahead present (in yytoken) is
|
|
||||||
if this state is a consistent state with a default action.
|
|
||||||
Thus, detecting the absence of a lookahead is sufficient to
|
|
||||||
determine that there is no unexpected or expected token to
|
|
||||||
report. In that case, just report a simple "syntax error".
|
|
||||||
- Don't assume there isn't a lookahead just because this state is
|
|
||||||
a consistent state with a default action. There might have
|
|
||||||
been a previous inconsistent state, consistent state with a
|
|
||||||
non-default action, or user semantic action that manipulated
|
|
||||||
yychar.
|
|
||||||
- Of course, the expected token list depends on states to have
|
|
||||||
correct lookahead information, and it depends on the parser not
|
|
||||||
to perform extra reductions after fetching a lookahead from the
|
|
||||||
scanner and before detecting a syntax error. Thus, state
|
|
||||||
merging (from LALR or IELR) and default reductions corrupt the
|
|
||||||
expected token list. However, the list is correct for
|
|
||||||
canonical LR with one exception: it will still contain any
|
|
||||||
token that will not be accepted due to an error action in a
|
|
||||||
later state.
|
|
||||||
*/
|
|
||||||
if (yytoken != yyempty_)
|
|
||||||
{
|
{
|
||||||
yyarg[yycount++] = yytname_[yytoken];
|
/* Start YYX at -YYN if negative to avoid negative indexes in
|
||||||
int yyn = yypact_[yystate];
|
YYCHECK. */
|
||||||
if (!yy_pact_value_is_default_ (yyn))
|
int yyxbegin = yyn < 0 ? -yyn : 0;
|
||||||
{
|
|
||||||
/* Start YYX at -YYN if negative to avoid negative indexes in
|
|
||||||
YYCHECK. In other words, skip the first -YYN actions for
|
|
||||||
this state because they are default actions. */
|
|
||||||
int yyxbegin = yyn < 0 ? -yyn : 0;
|
|
||||||
/* Stay within bounds of both yycheck and yytname. */
|
|
||||||
int yychecklim = yylast_ - yyn + 1;
|
|
||||||
int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
|
|
||||||
for (int yyx = yyxbegin; yyx < yyxend; ++yyx)
|
|
||||||
if (yycheck_[yyx + yyn] == yyx && yyx != yyterror_
|
|
||||||
&& !yy_table_value_is_error_ (yytable_[yyx + yyn]))
|
|
||||||
{
|
|
||||||
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
|
|
||||||
{
|
|
||||||
yycount = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
yyarg[yycount++] = yytname_[yyx];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
char const* yyformat = 0;
|
/* Stay within bounds of both yycheck and yytname. */
|
||||||
switch (yycount)
|
int yychecklim = yylast_ - yyn + 1;
|
||||||
{
|
int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
|
||||||
#define YYCASE_(N, S) \
|
int count = 0;
|
||||||
case N: \
|
for (int x = yyxbegin; x < yyxend; ++x)
|
||||||
yyformat = S; \
|
if (yycheck_[x + yyn] == x && x != yyterror_)
|
||||||
break
|
++count;
|
||||||
YYCASE_(0, YY_("syntax error"));
|
|
||||||
YYCASE_(1, YY_("syntax error, unexpected %s"));
|
|
||||||
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
|
|
||||||
YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
|
|
||||||
YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
|
|
||||||
YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
|
|
||||||
#undef YYCASE_
|
|
||||||
}
|
|
||||||
|
|
||||||
// Argument number.
|
// FIXME: This method of building the message is not compatible
|
||||||
size_t yyi = 0;
|
// with internationalization. It should work like yacc.c does it.
|
||||||
for (char const* yyp = yyformat; *yyp; ++yyp)
|
// That is, first build a string that looks like this:
|
||||||
if (yyp[0] == '%' && yyp[1] == 's' && yyi < yycount)
|
// "syntax error, unexpected %s or %s or %s"
|
||||||
{
|
// Then, invoke YY_ on this string.
|
||||||
yyres += yytnamerr_ (yyarg[yyi++]);
|
// Finally, use the string as a format to output
|
||||||
++yyp;
|
// yytname_[tok], etc.
|
||||||
}
|
// Until this gets fixed, this message appears in English only.
|
||||||
else
|
res = "syntax error, unexpected ";
|
||||||
yyres += *yyp;
|
res += yytnamerr_ (yytname_[tok]);
|
||||||
return yyres;]], [[
|
if (count < 5)
|
||||||
return YY_("syntax error");]])[
|
{
|
||||||
|
count = 0;
|
||||||
|
for (int x = yyxbegin; x < yyxend; ++x)
|
||||||
|
if (yycheck_[x + yyn] == x && x != yyterror_)
|
||||||
|
{
|
||||||
|
res += (!count++) ? ", expecting " : " or ";
|
||||||
|
res += yytnamerr_ (yytname_[x]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
res = YY_("syntax error");
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -971,9 +882,9 @@ b4_error_verbose_if([int yystate, int yytoken],
|
|||||||
]b4_pact[
|
]b4_pact[
|
||||||
};
|
};
|
||||||
|
|
||||||
/* YYDEFACT[S] -- default reduction number in state S. Performed when
|
/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
|
||||||
YYTABLE doesn't specify something else to do. Zero means the
|
doesn't specify something else to do. Zero means the default is an
|
||||||
default is an error. */
|
error. */
|
||||||
const ]b4_int_type_for([b4_defact])[
|
const ]b4_int_type_for([b4_defact])[
|
||||||
]b4_parser_class_name[::yydefact_[] =
|
]b4_parser_class_name[::yydefact_[] =
|
||||||
{
|
{
|
||||||
@@ -996,7 +907,7 @@ b4_error_verbose_if([int yystate, int yytoken],
|
|||||||
|
|
||||||
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
|
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
|
||||||
positive, shift that token. If negative, reduce the rule which
|
positive, shift that token. If negative, reduce the rule which
|
||||||
number is the opposite. If YYTABLE_NINF_, syntax error. */
|
number is the opposite. If zero, do what YYDEFACT says. */
|
||||||
const ]b4_int_type(b4_table_ninf, b4_table_ninf) b4_parser_class_name::yytable_ninf_ = b4_table_ninf[;
|
const ]b4_int_type(b4_table_ninf, b4_table_ninf) b4_parser_class_name::yytable_ninf_ = b4_table_ninf[;
|
||||||
const ]b4_int_type_for([b4_table])[
|
const ]b4_int_type_for([b4_table])[
|
||||||
]b4_parser_class_name[::yytable_[] =
|
]b4_parser_class_name[::yytable_[] =
|
||||||
@@ -1137,9 +1048,9 @@ b4_error_verbose_if([int yystate, int yytoken],
|
|||||||
|
|
||||||
]b4_epilogue
|
]b4_epilogue
|
||||||
dnl
|
dnl
|
||||||
@output(b4_dir_prefix[]stack.hh@)@
|
@output(b4_dir_prefix[]stack.hh@)
|
||||||
b4_copyright([Stack handling for Bison parsers in C++],
|
b4_copyright([Stack handling for Bison parsers in C++],
|
||||||
[2002-2011])[
|
[2002, 2003, 2004, 2005, 2006])[
|
||||||
|
|
||||||
#ifndef BISON_STACK_HH
|
#ifndef BISON_STACK_HH
|
||||||
# define BISON_STACK_HH
|
# define BISON_STACK_HH
|
||||||
@@ -1234,6 +1145,5 @@ b4_copyright([Stack handling for Bison parsers in C++],
|
|||||||
};
|
};
|
||||||
]b4_namespace_close[
|
]b4_namespace_close[
|
||||||
|
|
||||||
#endif // not BISON_STACK_HH[]dnl
|
#endif // not BISON_STACK_HH]
|
||||||
]
|
|
||||||
m4_divert_pop(0)
|
m4_divert_pop(0)
|
||||||
|
|||||||
+107
-164
@@ -1,6 +1,6 @@
|
|||||||
# Java skeleton for Bison -*- autoconf -*-
|
# Java skeleton for Bison -*- autoconf -*-
|
||||||
|
|
||||||
# Copyright (C) 2007-2011 Free Software Foundation, Inc.
|
# Copyright (C) 2007 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -23,26 +23,20 @@ m4_ifval(m4_defn([b4_symbol_destructors]),
|
|||||||
[])
|
[])
|
||||||
|
|
||||||
m4_divert_push(0)dnl
|
m4_divert_push(0)dnl
|
||||||
@output(b4_parser_file_name@)@
|
@output(b4_parser_file_name@)
|
||||||
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in Java],
|
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in Java],
|
||||||
[2007-2011])
|
[2007])
|
||||||
|
|
||||||
b4_percent_define_ifdef([package], [package b4_percent_define_get([package]);
|
b4_percent_define_ifdef([package], [package b4_percent_define_get([package]);
|
||||||
])[/* First part of user declarations. */
|
])[/* First part of user declarations. */
|
||||||
]b4_pre_prologue
|
]b4_pre_prologue
|
||||||
b4_percent_code_get([[imports]])
|
b4_percent_code_get([[imports]])
|
||||||
[/**
|
[/**
|
||||||
* A Bison parser, automatically generated from <tt>]m4_bpatsubst(b4_file_name, [^"\(.*\)"$], [\1])[</tt>.
|
* A Bison parser, automatically generated from <tt>@ofile@</tt>.
|
||||||
*
|
*
|
||||||
* @@author LALR (1) parser skeleton written by Paolo Bonzini.
|
* @@author LALR (1) parser skeleton written by Paolo Bonzini.
|
||||||
*/
|
*/
|
||||||
]b4_public_if([public ])dnl
|
]b4_public_if([public ])b4_abstract_if([abstract ])[class ]b4_parser_class_name[
|
||||||
b4_abstract_if([abstract ])dnl
|
|
||||||
b4_final_if([final ])dnl
|
|
||||||
b4_strictfp_if([strictfp ])dnl
|
|
||||||
[class ]b4_parser_class_name[]dnl
|
|
||||||
b4_percent_define_get3([extends], [ extends ])dnl
|
|
||||||
b4_percent_define_get3([implements], [ implements ])[
|
|
||||||
{
|
{
|
||||||
]b4_identification[
|
]b4_identification[
|
||||||
|
|
||||||
@@ -63,7 +57,7 @@ b4_locations_if([[
|
|||||||
public ]b4_position_type[ end;
|
public ]b4_position_type[ end;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a <code>]b4_location_type[</code> denoting an empty range located at
|
* Create a ]b4_location_type[ denoting an empty range located at
|
||||||
* a given point.
|
* a given point.
|
||||||
* @@param loc The position at which the range is anchored. */
|
* @@param loc The position at which the range is anchored. */
|
||||||
public ]b4_location_type[ (]b4_position_type[ loc) {
|
public ]b4_location_type[ (]b4_position_type[ loc) {
|
||||||
@@ -73,7 +67,7 @@ b4_locations_if([[
|
|||||||
/**
|
/**
|
||||||
* Create a <code>]b4_location_type[</code> from the endpoints of the range.
|
* Create a <code>]b4_location_type[</code> from the endpoints of the range.
|
||||||
* @@param begin The first position included in the range.
|
* @@param begin The first position included in the range.
|
||||||
* @@param end The first position beyond the range. */
|
* @@param begin The first position beyond the range. */
|
||||||
public ]b4_location_type[ (]b4_position_type[ begin, ]b4_position_type[ end) {
|
public ]b4_location_type[ (]b4_position_type[ begin, ]b4_position_type[ end) {
|
||||||
this.begin = begin;
|
this.begin = begin;
|
||||||
this.end = end;
|
this.end = end;
|
||||||
@@ -102,10 +96,10 @@ b4_token_enums(b4_tokens)
|
|||||||
private ]b4_location_type[ yylloc (YYStack rhs, int n)
|
private ]b4_location_type[ yylloc (YYStack rhs, int n)
|
||||||
{
|
{
|
||||||
if (n > 0)
|
if (n > 0)
|
||||||
return new ]b4_location_type[ (rhs.locationAt (n-1).begin, rhs.locationAt (0).end);
|
return new ]b4_location_type[ (rhs.locationAt (1).begin, rhs.locationAt (n).end);
|
||||||
else
|
else
|
||||||
return new ]b4_location_type[ (rhs.locationAt (0).end);
|
return new ]b4_location_type[ (rhs.locationAt (0).end);
|
||||||
}]])[
|
}]])
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Communication interface between the scanner and the Bison-generated
|
* Communication interface between the scanner and the Bison-generated
|
||||||
@@ -130,15 +124,16 @@ b4_token_enums(b4_tokens)
|
|||||||
/**
|
/**
|
||||||
* Entry point for the scanner. Returns the token identifier corresponding
|
* Entry point for the scanner. Returns the token identifier corresponding
|
||||||
* to the next token and prepares to return the semantic value
|
* to the next token and prepares to return the semantic value
|
||||||
* ]b4_locations_if([and beginning/ending positions ])[of the token.
|
* ]b4_locations_if([and beginning/ending positions ])[of the token.
|
||||||
* @@return the token identifier corresponding to the next token. */
|
* @@return the token identifier corresponding to the next token. */
|
||||||
int yylex () ]b4_maybe_throws([b4_lex_throws])[;
|
int yylex () ]b4_maybe_throws([b4_lex_throws])[;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Entry point for error reporting. Emits an error
|
* Entry point for error reporting. Emits an error
|
||||||
* ]b4_locations_if([referring to the given location ])[in a user-defined way.
|
* ]b4_locations_if([ referring to the given location])[in a user-defined
|
||||||
|
* way.
|
||||||
*
|
*
|
||||||
* ]b4_locations_if([[@@param loc The location of the element to which the
|
* ]b4_locations_if([loc], [[The location of the element to which the
|
||||||
* error message is related]])[
|
* error message is related]])[
|
||||||
* @@param s The string for the error message. */
|
* @@param s The string for the error message. */
|
||||||
void yyerror (]b4_locations_if([b4_location_type[ loc, ]])[String s);]
|
void yyerror (]b4_locations_if([b4_location_type[ loc, ]])[String s);]
|
||||||
@@ -165,7 +160,7 @@ b4_lexer_if([[
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates the Bison-generated parser.
|
* Instantiates the Bison-generated parser.
|
||||||
* @@param yylexer The scanner that will supply tokens to the parser.
|
* @@param yylex The scanner that will supply tokens to the parser.
|
||||||
*/
|
*/
|
||||||
b4_lexer_if([[protected]], [[public]]) b4_parser_class_name[ (]b4_parse_param_decl([[Lexer yylexer]])[) {
|
b4_lexer_if([[protected]], [[public]]) b4_parser_class_name[ (]b4_parse_param_decl([[Lexer yylexer]])[) {
|
||||||
this.yylexer = yylexer;
|
this.yylexer = yylexer;
|
||||||
@@ -210,7 +205,7 @@ b4_lexer_if([[
|
|||||||
|
|
||||||
]b4_locations_if([
|
]b4_locations_if([
|
||||||
protected final void yyerror (String s) {
|
protected final void yyerror (String s) {
|
||||||
yylexer.yyerror ((]b4_location_type[)null, s);
|
yylexer.yyerror ((Location)null, s);
|
||||||
}
|
}
|
||||||
protected final void yyerror (]b4_position_type[ loc, String s) {
|
protected final void yyerror (]b4_position_type[ loc, String s) {
|
||||||
yylexer.yyerror (new ]b4_location_type[ (loc), s);
|
yylexer.yyerror (new ]b4_location_type[ (loc), s);
|
||||||
@@ -228,11 +223,11 @@ b4_lexer_if([[
|
|||||||
|
|
||||||
public int size = 16;
|
public int size = 16;
|
||||||
public int height = -1;
|
public int height = -1;
|
||||||
|
|
||||||
public final void push (int state, ]b4_yystype[ value]dnl
|
public final void push (int state, ]b4_yystype[ value]dnl
|
||||||
b4_locations_if([, ]b4_location_type[ loc])[) {
|
b4_locations_if([, ]b4_location_type[ loc])[) {
|
||||||
height++;
|
height++;
|
||||||
if (size == height)
|
if (size == height)
|
||||||
{
|
{
|
||||||
int[] newStateStack = new int[size * 2];
|
int[] newStateStack = new int[size * 2];
|
||||||
System.arraycopy (stateStack, 0, newStateStack, 0, height);
|
System.arraycopy (stateStack, 0, newStateStack, 0, height);
|
||||||
@@ -241,7 +236,7 @@ b4_lexer_if([[
|
|||||||
]b4_location_type[[] newLocStack = new ]b4_location_type[[size * 2];
|
]b4_location_type[[] newLocStack = new ]b4_location_type[[size * 2];
|
||||||
System.arraycopy (locStack, 0, newLocStack, 0, height);
|
System.arraycopy (locStack, 0, newLocStack, 0, height);
|
||||||
locStack = newLocStack;]])
|
locStack = newLocStack;]])
|
||||||
|
|
||||||
b4_yystype[[] newValueStack = new ]b4_yystype[[size * 2];
|
b4_yystype[[] newValueStack = new ]b4_yystype[[size * 2];
|
||||||
System.arraycopy (valueStack, 0, newValueStack, 0, height);
|
System.arraycopy (valueStack, 0, newValueStack, 0, height);
|
||||||
valueStack = newValueStack;
|
valueStack = newValueStack;
|
||||||
@@ -255,14 +250,14 @@ b4_lexer_if([[
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final void pop () {
|
public final void pop () {
|
||||||
pop (1);
|
height--;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void pop (int num) {
|
public final void pop (int num) {
|
||||||
// Avoid memory leaks... garbage collection is a white lie!
|
// Avoid memory leaks... garbage collection is a white lie!
|
||||||
if (num > 0) {
|
if (num > 0) {
|
||||||
java.util.Arrays.fill (valueStack, height - num + 1, height + 1, null);
|
java.util.Arrays.fill (valueStack, height - num + 1, height, null);
|
||||||
]b4_locations_if([[java.util.Arrays.fill (locStack, height - num + 1, height + 1, null);]])[
|
]b4_locations_if([[java.util.Arrays.fill (locStack, height - num + 1, height, null);]])[
|
||||||
}
|
}
|
||||||
height -= num;
|
height -= num;
|
||||||
}
|
}
|
||||||
@@ -283,8 +278,8 @@ b4_lexer_if([[
|
|||||||
public void print (java.io.PrintStream out)
|
public void print (java.io.PrintStream out)
|
||||||
{
|
{
|
||||||
out.print ("Stack now");
|
out.print ("Stack now");
|
||||||
|
|
||||||
for (int i = 0; i <= height; i++)
|
for (int i = 0; i < height; i++)
|
||||||
{
|
{
|
||||||
out.print (' ');
|
out.print (' ');
|
||||||
out.print (stateStack[i]);
|
out.print (stateStack[i]);
|
||||||
@@ -308,9 +303,11 @@ b4_lexer_if([[
|
|||||||
* printing an error message. */
|
* printing an error message. */
|
||||||
public static final int YYERROR = 2;
|
public static final int YYERROR = 2;
|
||||||
|
|
||||||
// Internal return codes that are not supported for user semantic
|
/**
|
||||||
// actions.
|
* Returned by a Bison action in order to print an error message and start
|
||||||
private static final int YYERRLAB = 3;
|
* error recovery. */
|
||||||
|
public static final int YYFAIL = 3;
|
||||||
|
|
||||||
private static final int YYNEWSTATE = 4;
|
private static final int YYNEWSTATE = 4;
|
||||||
private static final int YYDEFAULT = 5;
|
private static final int YYDEFAULT = 5;
|
||||||
private static final int YYREDUCE = 6;
|
private static final int YYREDUCE = 6;
|
||||||
@@ -328,14 +325,14 @@ b4_lexer_if([[
|
|||||||
return yyerrstatus_ == 0;
|
return yyerrstatus_ == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int yyaction (int yyn, YYStack yystack, int yylen) ]b4_maybe_throws([b4_throws])[
|
private int yyaction (int yyn, YYStack yystack, int yylen)
|
||||||
{
|
{
|
||||||
]b4_yystype[ yyval;
|
]b4_yystype[ yyval;
|
||||||
]b4_locations_if([b4_location_type[ yyloc = yylloc (yystack, yylen);]])[
|
]b4_locations_if([b4_location_type[ yyloc = yylloc (yystack, yylen);]])[
|
||||||
|
|
||||||
/* If YYLEN is nonzero, implement the default value of the action:
|
/* If YYLEN is nonzero, implement the default value of the action:
|
||||||
`$$ = $1'. Otherwise, use the top of the stack.
|
`$$ = $1'. Otherwise, use the top of the stack.
|
||||||
|
|
||||||
Otherwise, the following line sets YYVAL to garbage.
|
Otherwise, the following line sets YYVAL to garbage.
|
||||||
This behavior is undocumented and Bison
|
This behavior is undocumented and Bison
|
||||||
users should not rely upon it. */
|
users should not rely upon it. */
|
||||||
@@ -343,7 +340,7 @@ b4_lexer_if([[
|
|||||||
yyval = yystack.valueAt (yylen - 1);
|
yyval = yystack.valueAt (yylen - 1);
|
||||||
else
|
else
|
||||||
yyval = yystack.valueAt (0);
|
yyval = yystack.valueAt (0);
|
||||||
|
|
||||||
yy_reduce_print (yyn, yystack);
|
yy_reduce_print (yyn, yystack);
|
||||||
|
|
||||||
switch (yyn)
|
switch (yyn)
|
||||||
@@ -417,7 +414,7 @@ b4_lexer_if([[
|
|||||||
yycdebug (s + (yytype < yyntokens_ ? " token " : " nterm ")
|
yycdebug (s + (yytype < yyntokens_ ? " token " : " nterm ")
|
||||||
+ yytname_[yytype] + " ("]b4_locations_if([
|
+ yytname_[yytype] + " ("]b4_locations_if([
|
||||||
+ yylocationp + ": "])[
|
+ yylocationp + ": "])[
|
||||||
+ (yyvaluep == null ? "(null)" : yyvaluep.toString ()) + ")");
|
+ (yyvaluep == null ? "(null)" : yyvaluep) + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -427,7 +424,7 @@ b4_lexer_if([[
|
|||||||
* @@return <tt>true</tt> if the parsing succeeds. Note that this does not
|
* @@return <tt>true</tt> if the parsing succeeds. Note that this does not
|
||||||
* imply that there were no syntax errors.
|
* imply that there were no syntax errors.
|
||||||
*/
|
*/
|
||||||
public boolean parse () ]b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])[
|
public boolean parse () ]b4_maybe_throws([b4_throws])[
|
||||||
{
|
{
|
||||||
/// Lookahead and lookahead in internal form.
|
/// Lookahead and lookahead in internal form.
|
||||||
int yychar = yyempty_;
|
int yychar = yyempty_;
|
||||||
@@ -480,19 +477,19 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
yycdebug ("Entering state " + yystate + "\n");
|
yycdebug ("Entering state " + yystate + "\n");
|
||||||
if (yydebug > 0)
|
if (yydebug > 0)
|
||||||
yystack.print (yyDebugStream);
|
yystack.print (yyDebugStream);
|
||||||
|
|
||||||
/* Accept? */
|
/* Accept? */
|
||||||
if (yystate == yyfinal_)
|
if (yystate == yyfinal_)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
/* Take a decision. First try without lookahead. */
|
/* Take a decision. First try without lookahead. */
|
||||||
yyn = yypact_[yystate];
|
yyn = yypact_[yystate];
|
||||||
if (yy_pact_value_is_default_ (yyn))
|
if (yyn == yypact_ninf_)
|
||||||
{
|
{
|
||||||
label = YYDEFAULT;
|
label = YYDEFAULT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read a lookahead token. */
|
/* Read a lookahead token. */
|
||||||
if (yychar == yyempty_)
|
if (yychar == yyempty_)
|
||||||
{
|
{
|
||||||
@@ -500,10 +497,10 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
yychar = yylex ();]
|
yychar = yylex ();]
|
||||||
b4_locations_if([[
|
b4_locations_if([[
|
||||||
yylloc = new ]b4_location_type[(yylexer.getStartPos (),
|
yylloc = new ]b4_location_type[(yylexer.getStartPos (),
|
||||||
yylexer.getEndPos ());]])
|
yylexer.getEndPos ());]])
|
||||||
yylval = yylexer.getLVal ();[
|
yylval = yylexer.getLVal ();[
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert token to internal form. */
|
/* Convert token to internal form. */
|
||||||
if (yychar <= EOF)
|
if (yychar <= EOF)
|
||||||
{
|
{
|
||||||
@@ -514,58 +511,58 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
{
|
{
|
||||||
yytoken = yytranslate_ (yychar);
|
yytoken = yytranslate_ (yychar);
|
||||||
yy_symbol_print ("Next token is", yytoken,
|
yy_symbol_print ("Next token is", yytoken,
|
||||||
yylval]b4_locations_if([, yylloc])[);
|
yylval]b4_locations_if([, yylloc])[);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the proper action on seeing token YYTOKEN is to reduce or to
|
/* If the proper action on seeing token YYTOKEN is to reduce or to
|
||||||
detect an error, take that action. */
|
detect an error, take that action. */
|
||||||
yyn += yytoken;
|
yyn += yytoken;
|
||||||
if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yytoken)
|
if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yytoken)
|
||||||
label = YYDEFAULT;
|
label = YYDEFAULT;
|
||||||
|
|
||||||
/* <= 0 means reduce or error. */
|
/* <= 0 means reduce or error. */
|
||||||
else if ((yyn = yytable_[yyn]) <= 0)
|
else if ((yyn = yytable_[yyn]) <= 0)
|
||||||
{
|
{
|
||||||
if (yy_table_value_is_error_ (yyn))
|
if (yyn == 0 || yyn == yytable_ninf_)
|
||||||
label = YYERRLAB;
|
label = YYFAIL;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
yyn = -yyn;
|
yyn = -yyn;
|
||||||
label = YYREDUCE;
|
label = YYREDUCE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Shift the lookahead token. */
|
/* Shift the lookahead token. */
|
||||||
yy_symbol_print ("Shifting", yytoken,
|
yy_symbol_print ("Shifting", yytoken,
|
||||||
yylval]b4_locations_if([, yylloc])[);
|
yylval]b4_locations_if([, yylloc])[);
|
||||||
|
|
||||||
/* Discard the token being shifted. */
|
/* Discard the token being shifted. */
|
||||||
yychar = yyempty_;
|
yychar = yyempty_;
|
||||||
|
|
||||||
/* Count tokens shifted since error; after three, turn off error
|
/* Count tokens shifted since error; after three, turn off error
|
||||||
status. */
|
status. */
|
||||||
if (yyerrstatus_ > 0)
|
if (yyerrstatus_ > 0)
|
||||||
--yyerrstatus_;
|
--yyerrstatus_;
|
||||||
|
|
||||||
yystate = yyn;
|
yystate = yyn;
|
||||||
yystack.push (yystate, yylval]b4_locations_if([, yylloc])[);
|
yystack.push (yystate, yylval]b4_locations_if([, yylloc])[);
|
||||||
label = YYNEWSTATE;
|
label = YYNEWSTATE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*-----------------------------------------------------------.
|
/*-----------------------------------------------------------.
|
||||||
| yydefault -- do the default action for the current state. |
|
| yydefault -- do the default action for the current state. |
|
||||||
`-----------------------------------------------------------*/
|
`-----------------------------------------------------------*/
|
||||||
case YYDEFAULT:
|
case YYDEFAULT:
|
||||||
yyn = yydefact_[yystate];
|
yyn = yydefact_[yystate];
|
||||||
if (yyn == 0)
|
if (yyn == 0)
|
||||||
label = YYERRLAB;
|
label = YYFAIL;
|
||||||
else
|
else
|
||||||
label = YYREDUCE;
|
label = YYREDUCE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*-----------------------------.
|
/*-----------------------------.
|
||||||
| yyreduce -- Do a reduction. |
|
| yyreduce -- Do a reduction. |
|
||||||
`-----------------------------*/
|
`-----------------------------*/
|
||||||
@@ -574,26 +571,24 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
label = yyaction (yyn, yystack, yylen);
|
label = yyaction (yyn, yystack, yylen);
|
||||||
yystate = yystack.stateAt (0);
|
yystate = yystack.stateAt (0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*------------------------------------.
|
/*------------------------------------.
|
||||||
| yyerrlab -- here on detecting error |
|
| yyerrlab -- here on detecting error |
|
||||||
`------------------------------------*/
|
`------------------------------------*/
|
||||||
case YYERRLAB:
|
case YYFAIL:
|
||||||
/* If not already recovering from an error, report this error. */
|
/* If not already recovering from an error, report this error. */
|
||||||
if (yyerrstatus_ == 0)
|
if (yyerrstatus_ == 0)
|
||||||
{
|
{
|
||||||
++yynerrs_;
|
++yynerrs_;
|
||||||
if (yychar == yyempty_)
|
yyerror (]b4_locations_if([yylloc, ])[yysyntax_error (yystate, yytoken));
|
||||||
yytoken = yyempty_;
|
|
||||||
yyerror (]b4_locations_if([yylloc, ])[yysyntax_error (yystate, yytoken));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
]b4_locations_if([yyerrloc = yylloc;])[
|
]b4_locations_if([yyerrloc = yylloc;])[
|
||||||
if (yyerrstatus_ == 3)
|
if (yyerrstatus_ == 3)
|
||||||
{
|
{
|
||||||
/* If just tried and failed to reuse lookahead token after an
|
/* If just tried and failed to reuse lookahead token after an
|
||||||
error, discard it. */
|
error, discard it. */
|
||||||
|
|
||||||
if (yychar <= EOF)
|
if (yychar <= EOF)
|
||||||
{
|
{
|
||||||
/* Return failure if at end of input. */
|
/* Return failure if at end of input. */
|
||||||
@@ -603,17 +598,17 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
else
|
else
|
||||||
yychar = yyempty_;
|
yychar = yyempty_;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Else will try to reuse lookahead token after shifting the error
|
/* Else will try to reuse lookahead token after shifting the error
|
||||||
token. */
|
token. */
|
||||||
label = YYERRLAB1;
|
label = YYERRLAB1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*---------------------------------------------------.
|
/*---------------------------------------------------.
|
||||||
| errorlab -- error raised explicitly by YYERROR. |
|
| errorlab -- error raised explicitly by YYERROR. |
|
||||||
`---------------------------------------------------*/
|
`---------------------------------------------------*/
|
||||||
case YYERROR:
|
case YYERROR:
|
||||||
|
|
||||||
]b4_locations_if([yyerrloc = yystack.locationAt (yylen - 1);])[
|
]b4_locations_if([yyerrloc = yystack.locationAt (yylen - 1);])[
|
||||||
/* Do not reclaim the symbols of the rule which action triggered
|
/* Do not reclaim the symbols of the rule which action triggered
|
||||||
this YYERROR. */
|
this YYERROR. */
|
||||||
@@ -622,17 +617,17 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
yystate = yystack.stateAt (0);
|
yystate = yystack.stateAt (0);
|
||||||
label = YYERRLAB1;
|
label = YYERRLAB1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*-------------------------------------------------------------.
|
/*-------------------------------------------------------------.
|
||||||
| yyerrlab1 -- common code for both syntax error and YYERROR. |
|
| yyerrlab1 -- common code for both syntax error and YYERROR. |
|
||||||
`-------------------------------------------------------------*/
|
`-------------------------------------------------------------*/
|
||||||
case YYERRLAB1:
|
case YYERRLAB1:
|
||||||
yyerrstatus_ = 3; /* Each real token shifted decrements this. */
|
yyerrstatus_ = 3; /* Each real token shifted decrements this. */
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
yyn = yypact_[yystate];
|
yyn = yypact_[yystate];
|
||||||
if (!yy_pact_value_is_default_ (yyn))
|
if (yyn != yypact_ninf_)
|
||||||
{
|
{
|
||||||
yyn += yyterror_;
|
yyn += yyterror_;
|
||||||
if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_)
|
if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_)
|
||||||
@@ -642,18 +637,18 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Pop the current state because it cannot handle the error token. */
|
/* Pop the current state because it cannot handle the error token. */
|
||||||
if (yystack.height == 1)
|
if (yystack.height == 1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
]b4_locations_if([yyerrloc = yystack.locationAt (0);])[
|
]b4_locations_if([yyerrloc = yystack.locationAt (0);])[
|
||||||
yystack.pop ();
|
yystack.pop ();
|
||||||
yystate = yystack.stateAt (0);
|
yystate = yystack.stateAt (0);
|
||||||
if (yydebug > 0)
|
if (yydebug > 0)
|
||||||
yystack.print (yyDebugStream);
|
yystack.print (yyDebugStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
]b4_locations_if([
|
]b4_locations_if([
|
||||||
/* Muck with the stack to setup for yylloc. */
|
/* Muck with the stack to setup for yylloc. */
|
||||||
yystack.push (0, null, yylloc);
|
yystack.push (0, null, yylloc);
|
||||||
@@ -664,16 +659,16 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
/* Shift the error token. */
|
/* Shift the error token. */
|
||||||
yy_symbol_print ("Shifting", yystos_[yyn],
|
yy_symbol_print ("Shifting", yystos_[yyn],
|
||||||
yylval]b4_locations_if([, yyloc])[);
|
yylval]b4_locations_if([, yyloc])[);
|
||||||
|
|
||||||
yystate = yyn;
|
yystate = yyn;
|
||||||
yystack.push (yyn, yylval]b4_locations_if([, yyloc])[);
|
yystack.push (yyn, yylval]b4_locations_if([, yyloc])[);
|
||||||
label = YYNEWSTATE;
|
label = YYNEWSTATE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Accept. */
|
/* Accept. */
|
||||||
case YYACCEPT:
|
case YYACCEPT:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
/* Abort. */
|
/* Abort. */
|
||||||
case YYABORT:
|
case YYABORT:
|
||||||
return false;
|
return false;
|
||||||
@@ -685,96 +680,44 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
{
|
{
|
||||||
if (errorVerbose)
|
if (errorVerbose)
|
||||||
{
|
{
|
||||||
/* There are many possibilities here to consider:
|
int yyn = yypact_[yystate];
|
||||||
- Assume YYFAIL is not used. It's too flawed to consider.
|
if (yypact_ninf_ < yyn && yyn <= yylast_)
|
||||||
See
|
|
||||||
<http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
|
|
||||||
for details. YYERROR is fine as it does not invoke this
|
|
||||||
function.
|
|
||||||
- If this state is a consistent state with a default action,
|
|
||||||
then the only way this function was invoked is if the
|
|
||||||
default action is an error action. In that case, don't
|
|
||||||
check for expected tokens because there are none.
|
|
||||||
- The only way there can be no lookahead present (in tok) is
|
|
||||||
if this state is a consistent state with a default action.
|
|
||||||
Thus, detecting the absence of a lookahead is sufficient to
|
|
||||||
determine that there is no unexpected or expected token to
|
|
||||||
report. In that case, just report a simple "syntax error".
|
|
||||||
- Don't assume there isn't a lookahead just because this
|
|
||||||
state is a consistent state with a default action. There
|
|
||||||
might have been a previous inconsistent state, consistent
|
|
||||||
state with a non-default action, or user semantic action
|
|
||||||
that manipulated yychar. (However, yychar is currently out
|
|
||||||
of scope during semantic actions.)
|
|
||||||
- Of course, the expected token list depends on states to
|
|
||||||
have correct lookahead information, and it depends on the
|
|
||||||
parser not to perform extra reductions after fetching a
|
|
||||||
lookahead from the scanner and before detecting a syntax
|
|
||||||
error. Thus, state merging (from LALR or IELR) and default
|
|
||||||
reductions corrupt the expected token list. However, the
|
|
||||||
list is correct for canonical LR with one exception: it
|
|
||||||
will still contain any token that will not be accepted due
|
|
||||||
to an error action in a later state.
|
|
||||||
*/
|
|
||||||
if (tok != yyempty_)
|
|
||||||
{
|
{
|
||||||
// FIXME: This method of building the message is not compatible
|
StringBuffer res;
|
||||||
// with internationalization.
|
|
||||||
StringBuffer res =
|
/* Start YYX at -YYN if negative to avoid negative indexes in
|
||||||
new StringBuffer ("syntax error, unexpected ");
|
YYCHECK. */
|
||||||
res.append (yytnamerr_ (yytname_[tok]));
|
int yyxbegin = yyn < 0 ? -yyn : 0;
|
||||||
int yyn = yypact_[yystate];
|
|
||||||
if (!yy_pact_value_is_default_ (yyn))
|
/* Stay within bounds of both yycheck and yytname. */
|
||||||
{
|
int yychecklim = yylast_ - yyn + 1;
|
||||||
/* Start YYX at -YYN if negative to avoid negative
|
int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
|
||||||
indexes in YYCHECK. In other words, skip the first
|
int count = 0;
|
||||||
-YYN actions for this state because they are default
|
for (int x = yyxbegin; x < yyxend; ++x)
|
||||||
actions. */
|
if (yycheck_[x + yyn] == x && x != yyterror_)
|
||||||
int yyxbegin = yyn < 0 ? -yyn : 0;
|
++count;
|
||||||
/* Stay within bounds of both yycheck and yytname. */
|
|
||||||
int yychecklim = yylast_ - yyn + 1;
|
// FIXME: This method of building the message is not compatible
|
||||||
int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
|
// with internationalization.
|
||||||
int count = 0;
|
res = new StringBuffer ("syntax error, unexpected ");
|
||||||
for (int x = yyxbegin; x < yyxend; ++x)
|
res.append (yytnamerr_ (yytname_[tok]));
|
||||||
if (yycheck_[x + yyn] == x && x != yyterror_
|
if (count < 5)
|
||||||
&& !yy_table_value_is_error_ (yytable_[x + yyn]))
|
{
|
||||||
++count;
|
count = 0;
|
||||||
if (count < 5)
|
for (int x = yyxbegin; x < yyxend; ++x)
|
||||||
{
|
if (yycheck_[x + yyn] == x && x != yyterror_)
|
||||||
count = 0;
|
{
|
||||||
for (int x = yyxbegin; x < yyxend; ++x)
|
res.append (count++ == 0 ? ", expecting " : " or ");
|
||||||
if (yycheck_[x + yyn] == x && x != yyterror_
|
res.append (yytnamerr_ (yytname_[x]));
|
||||||
&& !yy_table_value_is_error_ (yytable_[x + yyn]))
|
}
|
||||||
{
|
}
|
||||||
res.append (count++ == 0 ? ", expecting " : " or ");
|
return res.toString ();
|
||||||
res.append (yytnamerr_ (yytname_[x]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return res.toString ();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return "syntax error";
|
return "syntax error";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether the given <code>yypact_</code> value indicates a defaulted state.
|
|
||||||
* @@param yyvalue the value to check
|
|
||||||
*/
|
|
||||||
private static boolean yy_pact_value_is_default_ (int yyvalue)
|
|
||||||
{
|
|
||||||
return yyvalue == yypact_ninf_;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether the given <code>yytable_</code> value indicates a syntax error.
|
|
||||||
* @@param yyvalue the value to check
|
|
||||||
*/
|
|
||||||
private static boolean yy_table_value_is_error_ (int yyvalue)
|
|
||||||
{
|
|
||||||
return yyvalue == yytable_ninf_;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
|
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
|
||||||
STATE-NUM. */
|
STATE-NUM. */
|
||||||
@@ -784,9 +727,9 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
]b4_pact[
|
]b4_pact[
|
||||||
};
|
};
|
||||||
|
|
||||||
/* YYDEFACT[S] -- default reduction number in state S. Performed when
|
/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
|
||||||
YYTABLE doesn't specify something else to do. Zero means the
|
doesn't specify something else to do. Zero means the default is an
|
||||||
default is an error. */
|
error. */
|
||||||
private static final ]b4_int_type_for([b4_defact])[ yydefact_[] =
|
private static final ]b4_int_type_for([b4_defact])[ yydefact_[] =
|
||||||
{
|
{
|
||||||
]b4_defact[
|
]b4_defact[
|
||||||
@@ -807,7 +750,7 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
|
|
||||||
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
|
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
|
||||||
positive, shift that token. If negative, reduce the rule which
|
positive, shift that token. If negative, reduce the rule which
|
||||||
number is the opposite. If YYTABLE_NINF_, syntax error. */
|
number is the opposite. If zero, do what YYDEFACT says. */
|
||||||
private static final ]b4_int_type_for([b4_table])[ yytable_ninf_ = ]b4_table_ninf[;
|
private static final ]b4_int_type_for([b4_table])[ yytable_ninf_ = ]b4_table_ninf[;
|
||||||
private static final ]b4_int_type_for([b4_table])[
|
private static final ]b4_int_type_for([b4_table])[
|
||||||
yytable_[] =
|
yytable_[] =
|
||||||
@@ -894,7 +837,7 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
for (int yyi = 0; yyi < yynrhs; yyi++)
|
for (int yyi = 0; yyi < yynrhs; yyi++)
|
||||||
yy_symbol_print (" $" + (yyi + 1) + " =",
|
yy_symbol_print (" $" + (yyi + 1) + " =",
|
||||||
yyrhs_[yyprhs_[yyrule] + yyi],
|
yyrhs_[yyprhs_[yyrule] + yyi],
|
||||||
]b4_rhs_value(yynrhs, yyi + 1)b4_locations_if([,
|
]b4_rhs_value(yynrhs, yyi + 1)b4_locations_if([,
|
||||||
b4_rhs_location(yynrhs, yyi + 1)])[);
|
b4_rhs_location(yynrhs, yyi + 1)])[);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+10
-10
@@ -1,6 +1,7 @@
|
|||||||
# C++ skeleton for Bison
|
# C++ skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 2002-2007, 2009-2011 Free Software Foundation, Inc.
|
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation,
|
||||||
|
# Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -18,9 +19,9 @@
|
|||||||
# We do want M4 expansion after # for CPP macros.
|
# We do want M4 expansion after # for CPP macros.
|
||||||
m4_changecom()
|
m4_changecom()
|
||||||
m4_divert_push(0)dnl
|
m4_divert_push(0)dnl
|
||||||
@output(b4_dir_prefix[]position.hh@)@
|
@output(b4_dir_prefix[]position.hh@)
|
||||||
b4_copyright([Positions for Bison parsers in C++],
|
b4_copyright([Positions for Bison parsers in C++],
|
||||||
[2002-2007, 2009-2011])[
|
[2002, 2003, 2004, 2005, 2006])[
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** \file position.hh
|
** \file position.hh
|
||||||
@@ -115,11 +116,10 @@ b4_copyright([Positions for Bison parsers in C++],
|
|||||||
inline bool
|
inline bool
|
||||||
operator== (const position& pos1, const position& pos2)
|
operator== (const position& pos1, const position& pos2)
|
||||||
{
|
{
|
||||||
return (pos1.line == pos2.line
|
return
|
||||||
&& pos1.column == pos2.column
|
(pos1.filename == pos2.filename
|
||||||
&& (pos1.filename == pos2.filename
|
|| pos1.filename && pos2.filename && *pos1.filename == *pos2.filename)
|
||||||
|| (pos1.filename && pos2.filename
|
&& pos1.line == pos2.line && pos1.column == pos2.column;
|
||||||
&& *pos1.filename == *pos2.filename)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Compare two position objects.
|
/// Compare two position objects.
|
||||||
@@ -143,9 +143,9 @@ b4_copyright([Positions for Bison parsers in C++],
|
|||||||
|
|
||||||
]b4_namespace_close[
|
]b4_namespace_close[
|
||||||
#endif // not BISON_POSITION_HH]
|
#endif // not BISON_POSITION_HH]
|
||||||
@output(b4_dir_prefix[]location.hh@)@
|
@output(b4_dir_prefix[]location.hh@)
|
||||||
b4_copyright([Locations for Bison parsers in C++],
|
b4_copyright([Locations for Bison parsers in C++],
|
||||||
[2002-2007, 2009-2011])[
|
[2002, 2003, 2004, 2005, 2006])[
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** \file location.hh
|
** \file location.hh
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
../../submodules/autoconf/lib/m4sugar/foreach.m4
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../submodules/autoconf/lib/m4sugar/m4sugar.m4
|
|
||||||
File diff suppressed because it is too large
Load Diff
+2
-1
@@ -2,8 +2,9 @@
|
|||||||
|
|
||||||
<!--
|
<!--
|
||||||
bison.xsl - common templates for Bison XSLT.
|
bison.xsl - common templates for Bison XSLT.
|
||||||
|
$Id$
|
||||||
|
|
||||||
Copyright (C) 2007-2011 Free Software Foundation, Inc.
|
Copyright (C) 2007 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
|||||||
+7
-22
@@ -2,8 +2,9 @@
|
|||||||
|
|
||||||
<!--
|
<!--
|
||||||
xml2dot.xsl - transform Bison XML Report into DOT.
|
xml2dot.xsl - transform Bison XML Report into DOT.
|
||||||
|
$Id$
|
||||||
|
|
||||||
Copyright (C) 2007-2011 Free Software Foundation, Inc.
|
Copyright (C) 2007 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
@@ -35,27 +36,11 @@
|
|||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="bison-xml-report">
|
<xsl:template match="bison-xml-report">
|
||||||
<xsl:text>// Generated by GNU Bison </xsl:text>
|
<xsl:apply-templates select="automaton"/>
|
||||||
<xsl:value-of select="@version"/>
|
|
||||||
<xsl:text>. </xsl:text>
|
|
||||||
<xsl:text>// Report bugs to <</xsl:text>
|
|
||||||
<xsl:value-of select="@bug-report"/>
|
|
||||||
<xsl:text>>. </xsl:text>
|
|
||||||
<xsl:text>// Home page: <</xsl:text>
|
|
||||||
<xsl:value-of select="@url"/>
|
|
||||||
<xsl:text>>. </xsl:text>
|
|
||||||
<xsl:apply-templates select="automaton">
|
|
||||||
<xsl:with-param name="filename" select="filename"/>
|
|
||||||
</xsl:apply-templates>
|
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="automaton">
|
<xsl:template match="automaton">
|
||||||
<xsl:param name="filename"/>
|
<xsl:text>digraph Automaton { </xsl:text>
|
||||||
<xsl:text>digraph "</xsl:text>
|
|
||||||
<xsl:call-template name="escape">
|
|
||||||
<xsl:with-param name="subject" select="$filename"/>
|
|
||||||
</xsl:call-template>
|
|
||||||
<xsl:text>" { </xsl:text>
|
|
||||||
<xsl:apply-templates select="state"/>
|
<xsl:apply-templates select="state"/>
|
||||||
<xsl:text>} </xsl:text>
|
<xsl:text>} </xsl:text>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
@@ -212,11 +197,11 @@
|
|||||||
<xsl:with-param name="search" select="$search"/>
|
<xsl:with-param name="search" select="$search"/>
|
||||||
<xsl:with-param name="replace" select="$replace"/>
|
<xsl:with-param name="replace" select="$replace"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<xsl:value-of select="$subject"/>
|
<xsl:value-of select="$subject"/>
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
</xsl:stylesheet>
|
</xsl:stylesheet>
|
||||||
|
|||||||
@@ -2,8 +2,9 @@
|
|||||||
|
|
||||||
<!--
|
<!--
|
||||||
xml2text.xsl - transform Bison XML Report into plain text.
|
xml2text.xsl - transform Bison XML Report into plain text.
|
||||||
|
$Id$
|
||||||
|
|
||||||
Copyright (C) 2007-2011 Free Software Foundation, Inc.
|
Copyright (C) 2007 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,9 @@
|
|||||||
|
|
||||||
<!--
|
<!--
|
||||||
xml2html.xsl - transform Bison XML Report into XHTML.
|
xml2html.xsl - transform Bison XML Report into XHTML.
|
||||||
|
$Id$
|
||||||
|
|
||||||
Copyright (C) 2007-2011 Free Software Foundation, Inc.
|
Copyright (C) 2007, 2008 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
@@ -48,15 +49,15 @@
|
|||||||
font-size: 9pt;
|
font-size: 9pt;
|
||||||
}
|
}
|
||||||
a:link {
|
a:link {
|
||||||
color: #1f00ff;
|
color: #1f00ff;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
a:visited {
|
a:visited {
|
||||||
color: #1f00ff;
|
color: #1f00ff;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
a:hover {
|
a:hover {
|
||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
#menu a {
|
#menu a {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
|
|||||||
+317
-709
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
|||||||
# DJGPP Maintainer's Makefile -*-Makefile-*-
|
# DJGPP Maintainer's Makefile -*-Makefile-*-
|
||||||
# Requires GNU sed
|
# Requires GNU sed
|
||||||
|
|
||||||
## Copyright (C) 2005-2011 Free Software Foundation, Inc.
|
## Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
This is a port of GNU Bison @VERSION@ to MSDOS/DJGPP.
|
This is a port of GNU Bison @VERSION@ to MSDOS/DJGPP.
|
||||||
|
|
||||||
Copyright (C) 2005-2011 Free Software Foundation, Inc.
|
Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ Rem Configure Bison for DJGPP.
|
|||||||
Rem WARNING WARNING WARNING: This file needs to have DOS CRLF end-of-line
|
Rem WARNING WARNING WARNING: This file needs to have DOS CRLF end-of-line
|
||||||
Rem format, or else stock DOS/Windows shells will refuse to run it.
|
Rem format, or else stock DOS/Windows shells will refuse to run it.
|
||||||
|
|
||||||
Rem Copyright (C) 2005-2011 Free Software Foundation, Inc.
|
Rem Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Rem This program is free software: you can redistribute it and/or modify
|
Rem This program is free software: you can redistribute it and/or modify
|
||||||
Rem it under the terms of the GNU General Public License as published by
|
Rem it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+2
-1
@@ -2,7 +2,8 @@
|
|||||||
# Sed script for additional DJGPP specific editing
|
# Sed script for additional DJGPP specific editing
|
||||||
# of the configure script generated by autoconf 2.62.
|
# of the configure script generated by autoconf 2.62.
|
||||||
|
|
||||||
# Copyright (C) 2005-2011 Free Software Foundation, Inc.
|
|
||||||
|
# Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
# This is the config.site file for configuring GNU packages
|
# This is the config.site file for configuring GNU packages
|
||||||
# which are to be built with DJGPP tools.
|
# which are to be built with DJGPP tools.
|
||||||
|
|
||||||
# Copyright (C) 2005-2011 Free Software Foundation, Inc.
|
# Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
# sed script for DJGPP specific editing of config.hin
|
# sed script for DJGPP specific editing of config.hin
|
||||||
|
|
||||||
# Copyright (C) 2005-2011 Free Software Foundation, Inc.
|
# Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@ Rem This batch file unpacks the Bison distribution while simultaneously
|
|||||||
Rem renaming some of the files whose names are invalid on DOS or conflict
|
Rem renaming some of the files whose names are invalid on DOS or conflict
|
||||||
Rem with other file names after truncation to DOS 8+3 namespace.
|
Rem with other file names after truncation to DOS 8+3 namespace.
|
||||||
Rem
|
Rem
|
||||||
Rem Copyright (C) 2005-2011 Free Software Foundation, Inc.
|
Rem Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||||
Rem
|
Rem
|
||||||
Rem This program is free software: you can redistribute it and/or modify
|
Rem This program is free software: you can redistribute it and/or modify
|
||||||
Rem it under the terms of the GNU General Public License as published by
|
Rem it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* Subprocesses with pipes.
|
/* Subprocesses with pipes.
|
||||||
|
|
||||||
Copyright (C) 2005-2011 Free Software Foundation, Inc.
|
Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+1
-2
@@ -1,6 +1,5 @@
|
|||||||
/* Subprocesses with pipes.
|
/* Subprocesses with pipes.
|
||||||
|
Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||||
Copyright (C) 2005-2011 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+2
-1
@@ -2,7 +2,8 @@
|
|||||||
# Sed script for additional DJGPP specific editing
|
# Sed script for additional DJGPP specific editing
|
||||||
# of the testsuite script generated by autoconf 2.61.
|
# of the testsuite script generated by autoconf 2.61.
|
||||||
|
|
||||||
# Copyright (C) 2007-2011 Free Software Foundation, Inc.
|
|
||||||
|
# Copyright (C) 2007, 2008 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
Makefile
|
||||||
|
bison.aux
|
||||||
|
bison.cp
|
||||||
|
bison.cps
|
||||||
|
bison.dvi
|
||||||
|
bison.fn
|
||||||
|
bison.html
|
||||||
|
bison.ky
|
||||||
|
bison.log
|
||||||
|
bison.pdf
|
||||||
|
bison.pg
|
||||||
|
bison.ps
|
||||||
|
bison.toc
|
||||||
|
bison.tp
|
||||||
|
bison.vr
|
||||||
|
cross-options.texi
|
||||||
|
Makefile.in
|
||||||
|
refcard.dvi
|
||||||
|
refcard.log
|
||||||
|
refcard.ps
|
||||||
|
*.info*
|
||||||
|
stamp-vti
|
||||||
|
version.texi
|
||||||
|
yacc.1
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
|
|
||||||
/*.info*
|
|
||||||
/*~
|
|
||||||
/.dirstamp
|
|
||||||
/Makefile
|
|
||||||
/Makefile.in
|
|
||||||
/bison.1
|
|
||||||
/bison.aux
|
|
||||||
/bison.cp
|
|
||||||
/bison.cps
|
|
||||||
/bison.dvi
|
|
||||||
/bison.fn
|
|
||||||
/bison.html
|
|
||||||
/bison.ky
|
|
||||||
/bison.log
|
|
||||||
/bison.pdf
|
|
||||||
/bison.pg
|
|
||||||
/bison.ps
|
|
||||||
/bison.toc
|
|
||||||
/bison.tp
|
|
||||||
/bison.vr
|
|
||||||
/cross-options.texi
|
|
||||||
/gendocs_template
|
|
||||||
/refcard.dvi
|
|
||||||
/refcard.log
|
|
||||||
/refcard.ps
|
|
||||||
/stamp-vti
|
|
||||||
/version.texi
|
|
||||||
/yacc.1
|
|
||||||
|
|
||||||
+1
-1
@@ -23,7 +23,7 @@ PROJECT_NAME = "@PACKAGE_NAME@"
|
|||||||
# This could be handy for archiving the generated documentation or
|
# This could be handy for archiving the generated documentation or
|
||||||
# if some version control system is used.
|
# if some version control system is used.
|
||||||
|
|
||||||
PROJECT_NUMBER = "@PACKAGE_VERSION@"
|
PROJECT_NUMBER = "@PACKAGE_VERSION@ @ID@"
|
||||||
|
|
||||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
|
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
|
||||||
# base path where the generated documentation will be put.
|
# base path where the generated documentation will be put.
|
||||||
|
|||||||
+16
-11
@@ -1,6 +1,5 @@
|
|||||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
||||||
|
## Copyright (C) 2001, 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||||
## Copyright (C) 2001-2003, 2005-2011 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -26,12 +25,9 @@ clean-local:
|
|||||||
|
|
||||||
CROSS_OPTIONS_PL = $(top_srcdir)/build-aux/cross-options.pl
|
CROSS_OPTIONS_PL = $(top_srcdir)/build-aux/cross-options.pl
|
||||||
$(srcdir)/cross-options.texi: $(top_srcdir)/src/getargs.c $(CROSS_OPTIONS_PL)
|
$(srcdir)/cross-options.texi: $(top_srcdir)/src/getargs.c $(CROSS_OPTIONS_PL)
|
||||||
mv -f $@ $@~ || : >$@~
|
-rm -f $@ $@.tmp
|
||||||
-rm -f $@.tmp
|
|
||||||
cd $(top_builddir)/src && $(MAKE) $(AM_MAKEFLAGS) bison
|
cd $(top_builddir)/src && $(MAKE) $(AM_MAKEFLAGS) bison
|
||||||
$(top_builddir)/src/bison --help \
|
$(top_builddir)/src/bison --help | perl $(CROSS_OPTIONS_PL) >$@.tmp
|
||||||
| perl $(CROSS_OPTIONS_PL) $(top_srcdir)/src/scan-gram.l >$@.tmp
|
|
||||||
diff -u $@~ $@.tmp || true
|
|
||||||
mv $@.tmp $@
|
mv $@.tmp $@
|
||||||
MAINTAINERCLEANFILES = $(srcdir)/cross-options.texi
|
MAINTAINERCLEANFILES = $(srcdir)/cross-options.texi
|
||||||
|
|
||||||
@@ -57,11 +53,15 @@ dist_man_MANS = $(srcdir)/bison.1
|
|||||||
EXTRA_DIST += $(dist_man_MANS:.1=.x) common.x
|
EXTRA_DIST += $(dist_man_MANS:.1=.x) common.x
|
||||||
MAINTAINERCLEANFILES += $(dist_man_MANS)
|
MAINTAINERCLEANFILES += $(dist_man_MANS)
|
||||||
|
|
||||||
# Depend on configure to get version number changes.
|
# Depend on configure.ac to get version number changes.
|
||||||
common_dep = $(top_srcdir)/configure $(srcdir)/common.x
|
common_dep = $(top_srcdir)/configure.ac $(srcdir)/common.x
|
||||||
srcsrcdir = $(top_srcdir)/bin
|
srcsrcdir = $(top_srcdir)/bin
|
||||||
$(srcdir)/bison.1: $(common_dep) $(top_srcdir)/src/getargs.c
|
$(srcdir)/bison.1: $(common_dep) $(top_srcdir)/src/getargs.c
|
||||||
|
|
||||||
|
# Output from --help and --version that must not appear in the man page.
|
||||||
|
neutralize = \
|
||||||
|
perl -0777 -pi -e 's/\.PP\nId:.*\n//g'
|
||||||
|
|
||||||
# Differences to ignore when comparing the man page (the date).
|
# Differences to ignore when comparing the man page (the date).
|
||||||
remove_time_stamp = \
|
remove_time_stamp = \
|
||||||
sed 's/^\(\.TH[^"]*"[^"]*"[^"]*\)"[^"]*"/\1/'
|
sed 's/^\(\.TH[^"]*"[^"]*"[^"]*\)"[^"]*"/\1/'
|
||||||
@@ -87,6 +87,7 @@ PREPATH = $(top_builddir)/src
|
|||||||
--include=$*.x \
|
--include=$*.x \
|
||||||
--include=$(srcdir)/common.x \
|
--include=$(srcdir)/common.x \
|
||||||
--output=$@.t `echo '$*' | sed 's,.*/,,'`
|
--output=$@.t `echo '$*' | sed 's,.*/,,'`
|
||||||
|
$(neutralize) $@.t
|
||||||
if $(remove_time_stamp) $@ >$@a.t 2>/dev/null && \
|
if $(remove_time_stamp) $@ >$@a.t 2>/dev/null && \
|
||||||
$(remove_time_stamp) $@.t | cmp $@a.t - >/dev/null 2>&1; then \
|
$(remove_time_stamp) $@.t | cmp $@a.t - >/dev/null 2>&1; then \
|
||||||
touch $@; \
|
touch $@; \
|
||||||
@@ -110,7 +111,8 @@ doc: html
|
|||||||
html-local: Doxyfile
|
html-local: Doxyfile
|
||||||
$(DOXYGEN)
|
$(DOXYGEN)
|
||||||
|
|
||||||
edit = sed -e 's,@PACKAGE_NAME\@,$(PACKAGE_NAME),g' \
|
edit = sed -e "s|@ID@|$$Id|" \
|
||||||
|
-e 's,@PACKAGE_NAME\@,$(PACKAGE_NAME),g' \
|
||||||
-e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' \
|
-e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' \
|
||||||
-e 's,@top_builddir\@,$(top_builddir),g' \
|
-e 's,@top_builddir\@,$(top_builddir),g' \
|
||||||
-e 's,@top_srcdir\@,$(top_srcdir),g'
|
-e 's,@top_srcdir\@,$(top_srcdir),g'
|
||||||
@@ -119,7 +121,10 @@ EXTRA_DIST += Doxyfile.in
|
|||||||
CLEANFILES += Doxyfile
|
CLEANFILES += Doxyfile
|
||||||
# Sed is used to generate Doxyfile from Doxyfile.in instead of
|
# Sed is used to generate Doxyfile from Doxyfile.in instead of
|
||||||
# configure, because the former is way faster than the latter.
|
# configure, because the former is way faster than the latter.
|
||||||
Doxyfile: $(srcdir)/Doxyfile.in
|
# Moreover, this file is updated whenever ChangeLog is touched: using
|
||||||
|
# sed instead of configure saves us a lot of time.
|
||||||
|
Doxyfile: $(top_srcdir)/ChangeLog $(srcdir)/Doxyfile.in
|
||||||
|
Id=`grep '^\$$Id' $(top_srcdir)/ChangeLog`; \
|
||||||
$(edit) $(srcdir)/Doxyfile.in >Doxyfile
|
$(edit) $(srcdir)/Doxyfile.in >Doxyfile
|
||||||
|
|
||||||
CLEANDIRS += html latex
|
CLEANDIRS += html latex
|
||||||
|
|||||||
+197
@@ -0,0 +1,197 @@
|
|||||||
|
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36.
|
||||||
|
.TH BISON "1" "March 2008" "bison 2.3a+" "User Commands"
|
||||||
|
.SH NAME
|
||||||
|
bison \- GNU Project parser generator (yacc replacement)
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.B bison
|
||||||
|
[\fIOPTION\fR]... \fIFILE\fR
|
||||||
|
.SH DESCRIPTION
|
||||||
|
.I Bison
|
||||||
|
is a parser generator in the style of
|
||||||
|
.IR yacc (1).
|
||||||
|
It should be upwardly compatible with input files designed
|
||||||
|
for
|
||||||
|
.IR yacc .
|
||||||
|
.PP
|
||||||
|
Input files should follow the
|
||||||
|
.I yacc
|
||||||
|
convention of ending in
|
||||||
|
.BR .y .
|
||||||
|
Unlike
|
||||||
|
.IR yacc ,
|
||||||
|
the generated files do not have fixed names, but instead use the prefix
|
||||||
|
of the input file.
|
||||||
|
Moreover, if you need to put
|
||||||
|
.I C++
|
||||||
|
code in the input file, you can end his name by a C++-like extension
|
||||||
|
(.ypp or .y++), then bison will follow your extension to name the
|
||||||
|
output file (.cpp or .c++).
|
||||||
|
For instance, a grammar description file named
|
||||||
|
.B parse.yxx
|
||||||
|
would produce the generated parser in a file named
|
||||||
|
.BR parse.tab.cxx ,
|
||||||
|
instead of
|
||||||
|
.IR yacc 's
|
||||||
|
.B y.tab.c
|
||||||
|
or old
|
||||||
|
.I Bison
|
||||||
|
version's
|
||||||
|
.BR parse.tab.c .
|
||||||
|
.PP
|
||||||
|
This description of the options that can be given to
|
||||||
|
.I bison
|
||||||
|
is adapted from the node
|
||||||
|
.B Invocation
|
||||||
|
in the
|
||||||
|
.B bison.texinfo
|
||||||
|
manual, which should be taken as authoritative.
|
||||||
|
.PP
|
||||||
|
.I Bison
|
||||||
|
supports both traditional single-letter options and mnemonic long
|
||||||
|
option names. Long option names are indicated with
|
||||||
|
.B \-\-
|
||||||
|
instead of
|
||||||
|
.BR \- .
|
||||||
|
Abbreviations for option names are allowed as long as they
|
||||||
|
are unique. When a long option takes an argument, like
|
||||||
|
.BR \-\-file-prefix ,
|
||||||
|
connect the option name and the argument with
|
||||||
|
.BR = .
|
||||||
|
.PP
|
||||||
|
Generate LALR(1) and GLR parsers.
|
||||||
|
.PP
|
||||||
|
Mandatory arguments to long options are mandatory for short options too.
|
||||||
|
The same is true for optional arguments.
|
||||||
|
.SS "Operation modes:"
|
||||||
|
.TP
|
||||||
|
\fB\-h\fR, \fB\-\-help\fR
|
||||||
|
display this help and exit
|
||||||
|
.TP
|
||||||
|
\fB\-V\fR, \fB\-\-version\fR
|
||||||
|
output version information and exit
|
||||||
|
.TP
|
||||||
|
\fB\-\-print\-localedir\fR
|
||||||
|
output directory containing locale\-dependent data
|
||||||
|
.TP
|
||||||
|
\fB\-\-print\-datadir\fR
|
||||||
|
output directory containing skeletons and XSLT
|
||||||
|
.TP
|
||||||
|
\fB\-y\fR, \fB\-\-yacc\fR
|
||||||
|
emulate POSIX Yacc
|
||||||
|
.TP
|
||||||
|
\fB\-W\fR, \fB\-\-warnings\fR=\fI[CATEGORY]\fR
|
||||||
|
report the warnings falling in CATEGORY
|
||||||
|
.SS "Parser:"
|
||||||
|
.TP
|
||||||
|
\fB\-L\fR, \fB\-\-language\fR=\fILANGUAGE\fR
|
||||||
|
specify the output programming language
|
||||||
|
.TP
|
||||||
|
\fB\-S\fR, \fB\-\-skeleton\fR=\fIFILE\fR
|
||||||
|
specify the skeleton to use
|
||||||
|
.TP
|
||||||
|
\fB\-t\fR, \fB\-\-debug\fR
|
||||||
|
instrument the parser for debugging
|
||||||
|
.TP
|
||||||
|
\fB\-\-locations\fR
|
||||||
|
enable locations computation
|
||||||
|
.TP
|
||||||
|
\fB\-p\fR, \fB\-\-name\-prefix\fR=\fIPREFIX\fR
|
||||||
|
prepend PREFIX to the external symbols
|
||||||
|
.TP
|
||||||
|
\fB\-l\fR, \fB\-\-no\-lines\fR
|
||||||
|
don't generate `#line' directives
|
||||||
|
.TP
|
||||||
|
\fB\-k\fR, \fB\-\-token\-table\fR
|
||||||
|
include a table of token names
|
||||||
|
.SS "Output:"
|
||||||
|
.TP
|
||||||
|
\fB\-\-defines\fR[=\fIFILE\fR]
|
||||||
|
also produce a header file
|
||||||
|
.TP
|
||||||
|
\fB\-d\fR
|
||||||
|
likewise but cannot specify FILE (for POSIX Yacc)
|
||||||
|
.TP
|
||||||
|
\fB\-r\fR, \fB\-\-report\fR=\fITHINGS\fR
|
||||||
|
also produce details on the automaton
|
||||||
|
.TP
|
||||||
|
\fB\-\-report\-file\fR=\fIFILE\fR
|
||||||
|
write report to FILE
|
||||||
|
.TP
|
||||||
|
\fB\-v\fR, \fB\-\-verbose\fR
|
||||||
|
same as `\-\-report=state'
|
||||||
|
.TP
|
||||||
|
\fB\-b\fR, \fB\-\-file\-prefix\fR=\fIPREFIX\fR
|
||||||
|
specify a PREFIX for output files
|
||||||
|
.TP
|
||||||
|
\fB\-o\fR, \fB\-\-output\fR=\fIFILE\fR
|
||||||
|
leave output to FILE
|
||||||
|
.TP
|
||||||
|
\fB\-g\fR, \fB\-\-graph\fR[=\fIFILE\fR]
|
||||||
|
also output a graph of the automaton
|
||||||
|
.TP
|
||||||
|
\fB\-x\fR, \fB\-\-xml\fR[=\fIFILE\fR]
|
||||||
|
also output an XML report of the automaton
|
||||||
|
(the XML schema is experimental)
|
||||||
|
.SS "Warning categories include:"
|
||||||
|
.TP
|
||||||
|
`midrule\-values'
|
||||||
|
unset or unused midrule values
|
||||||
|
.TP
|
||||||
|
`yacc'
|
||||||
|
incompatibilities with POSIX YACC
|
||||||
|
.TP
|
||||||
|
`all'
|
||||||
|
all the warnings
|
||||||
|
.TP
|
||||||
|
`no\-CATEGORY'
|
||||||
|
turn off warnings in CATEGORY
|
||||||
|
.TP
|
||||||
|
`none'
|
||||||
|
turn off all the warnings
|
||||||
|
.TP
|
||||||
|
`error'
|
||||||
|
treat warnings as errors
|
||||||
|
.SS "THINGS is a list of comma separated words that can include:"
|
||||||
|
.TP
|
||||||
|
`state'
|
||||||
|
describe the states
|
||||||
|
.TP
|
||||||
|
`itemset'
|
||||||
|
complete the core item sets with their closure
|
||||||
|
.TP
|
||||||
|
`lookahead'
|
||||||
|
explicitly associate lookahead tokens to items
|
||||||
|
.TP
|
||||||
|
`solved'
|
||||||
|
describe shift/reduce conflicts solving
|
||||||
|
.TP
|
||||||
|
`all'
|
||||||
|
include all the above information
|
||||||
|
.TP
|
||||||
|
`none'
|
||||||
|
disable the report
|
||||||
|
.SH AUTHOR
|
||||||
|
Written by Robert Corbett and Richard Stallman.
|
||||||
|
.SH "REPORTING BUGS"
|
||||||
|
Report bugs to <bug\-[email protected]>.
|
||||||
|
.SH COPYRIGHT
|
||||||
|
Copyright \(co 2007 Free Software Foundation, Inc.
|
||||||
|
.br
|
||||||
|
This is free software; see the source for copying conditions. There is NO
|
||||||
|
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
.SH "SEE ALSO"
|
||||||
|
.BR lex (1),
|
||||||
|
.BR flex (1),
|
||||||
|
.BR yacc (1).
|
||||||
|
.PP
|
||||||
|
The full documentation for
|
||||||
|
.B bison
|
||||||
|
is maintained as a Texinfo manual. If the
|
||||||
|
.B info
|
||||||
|
and
|
||||||
|
.B bison
|
||||||
|
programs are properly installed at your site, the command
|
||||||
|
.IP
|
||||||
|
.B info bison
|
||||||
|
.PP
|
||||||
|
should give you access to the complete manual.
|
||||||
+1149
-2198
File diff suppressed because it is too large
Load Diff
+13
-68
@@ -1,12 +1,12 @@
|
|||||||
@c The GNU Free Documentation License.
|
@c The GNU Free Documentation License.
|
||||||
@center Version 1.3, 3 November 2008
|
@center Version 1.2, November 2002
|
||||||
|
|
||||||
@c This file is intended to be included within another document,
|
@c This file is intended to be included within another document,
|
||||||
@c hence no sectioning command or @node.
|
@c hence no sectioning command or @node.
|
||||||
|
|
||||||
@display
|
@display
|
||||||
Copyright @copyright{} 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
|
Copyright @copyright{} 2000,2001,2002 Free Software Foundation, Inc.
|
||||||
@uref{http://fsf.org/}
|
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
of this license document, but changing it is not allowed.
|
of this license document, but changing it is not allowed.
|
||||||
@@ -111,9 +111,6 @@ formats which do not have any title page as such, ``Title Page'' means
|
|||||||
the text near the most prominent appearance of the work's title,
|
the text near the most prominent appearance of the work's title,
|
||||||
preceding the beginning of the body of the text.
|
preceding the beginning of the body of the text.
|
||||||
|
|
||||||
The ``publisher'' means any person or entity that distributes copies
|
|
||||||
of the Document to the public.
|
|
||||||
|
|
||||||
A section ``Entitled XYZ'' means a named subunit of the Document whose
|
A section ``Entitled XYZ'' means a named subunit of the Document whose
|
||||||
title either is precisely XYZ or contains XYZ in parentheses following
|
title either is precisely XYZ or contains XYZ in parentheses following
|
||||||
text that translates XYZ in another language. (Here XYZ stands for a
|
text that translates XYZ in another language. (Here XYZ stands for a
|
||||||
@@ -382,30 +379,13 @@ title.
|
|||||||
@item
|
@item
|
||||||
TERMINATION
|
TERMINATION
|
||||||
|
|
||||||
You may not copy, modify, sublicense, or distribute the Document
|
You may not copy, modify, sublicense, or distribute the Document except
|
||||||
except as expressly provided under this License. Any attempt
|
as expressly provided for under this License. Any other attempt to
|
||||||
otherwise to copy, modify, sublicense, or distribute it is void, and
|
copy, modify, sublicense or distribute the Document is void, and will
|
||||||
will automatically terminate your rights under this License.
|
automatically terminate your rights under this License. However,
|
||||||
|
parties who have received copies, or rights, from you under this
|
||||||
However, if you cease all violation of this License, then your license
|
License will not have their licenses terminated so long as such
|
||||||
from a particular copyright holder is reinstated (a) provisionally,
|
parties remain in full compliance.
|
||||||
unless and until the copyright holder explicitly and finally
|
|
||||||
terminates your license, and (b) permanently, if the copyright holder
|
|
||||||
fails to notify you of the violation by some reasonable means prior to
|
|
||||||
60 days after the cessation.
|
|
||||||
|
|
||||||
Moreover, your license from a particular copyright holder is
|
|
||||||
reinstated permanently if the copyright holder notifies you of the
|
|
||||||
violation by some reasonable means, this is the first time you have
|
|
||||||
received notice of violation of this License (for any work) from that
|
|
||||||
copyright holder, and you cure the violation prior to 30 days after
|
|
||||||
your receipt of the notice.
|
|
||||||
|
|
||||||
Termination of your rights under this section does not terminate the
|
|
||||||
licenses of parties who have received copies or rights from you under
|
|
||||||
this License. If your rights have been terminated and not permanently
|
|
||||||
reinstated, receipt of a copy of some or all of the same material does
|
|
||||||
not give you any rights to use it.
|
|
||||||
|
|
||||||
@item
|
@item
|
||||||
FUTURE REVISIONS OF THIS LICENSE
|
FUTURE REVISIONS OF THIS LICENSE
|
||||||
@@ -423,42 +403,7 @@ following the terms and conditions either of that specified version or
|
|||||||
of any later version that has been published (not as a draft) by the
|
of any later version that has been published (not as a draft) by the
|
||||||
Free Software Foundation. If the Document does not specify a version
|
Free Software Foundation. If the Document does not specify a version
|
||||||
number of this License, you may choose any version ever published (not
|
number of this License, you may choose any version ever published (not
|
||||||
as a draft) by the Free Software Foundation. If the Document
|
as a draft) by the Free Software Foundation.
|
||||||
specifies that a proxy can decide which future versions of this
|
|
||||||
License can be used, that proxy's public statement of acceptance of a
|
|
||||||
version permanently authorizes you to choose that version for the
|
|
||||||
Document.
|
|
||||||
|
|
||||||
@item
|
|
||||||
RELICENSING
|
|
||||||
|
|
||||||
``Massive Multiauthor Collaboration Site'' (or ``MMC Site'') means any
|
|
||||||
World Wide Web server that publishes copyrightable works and also
|
|
||||||
provides prominent facilities for anybody to edit those works. A
|
|
||||||
public wiki that anybody can edit is an example of such a server. A
|
|
||||||
``Massive Multiauthor Collaboration'' (or ``MMC'') contained in the
|
|
||||||
site means any set of copyrightable works thus published on the MMC
|
|
||||||
site.
|
|
||||||
|
|
||||||
``CC-BY-SA'' means the Creative Commons Attribution-Share Alike 3.0
|
|
||||||
license published by Creative Commons Corporation, a not-for-profit
|
|
||||||
corporation with a principal place of business in San Francisco,
|
|
||||||
California, as well as future copyleft versions of that license
|
|
||||||
published by that same organization.
|
|
||||||
|
|
||||||
``Incorporate'' means to publish or republish a Document, in whole or
|
|
||||||
in part, as part of another Document.
|
|
||||||
|
|
||||||
An MMC is ``eligible for relicensing'' if it is licensed under this
|
|
||||||
License, and if all works that were first published under this License
|
|
||||||
somewhere other than this MMC, and subsequently incorporated in whole
|
|
||||||
or in part into the MMC, (1) had no cover texts or invariant sections,
|
|
||||||
and (2) were thus incorporated prior to November 1, 2008.
|
|
||||||
|
|
||||||
The operator of an MMC Site may republish an MMC contained in the site
|
|
||||||
under CC-BY-SA on the same site at any time before August 1, 2009,
|
|
||||||
provided the MMC is eligible for relicensing.
|
|
||||||
|
|
||||||
@end enumerate
|
@end enumerate
|
||||||
|
|
||||||
@page
|
@page
|
||||||
@@ -472,7 +417,7 @@ license notices just after the title page:
|
|||||||
@group
|
@group
|
||||||
Copyright (C) @var{year} @var{your name}.
|
Copyright (C) @var{year} @var{your name}.
|
||||||
Permission is granted to copy, distribute and/or modify this document
|
Permission is granted to copy, distribute and/or modify this document
|
||||||
under the terms of the GNU Free Documentation License, Version 1.3
|
under the terms of the GNU Free Documentation License, Version 1.2
|
||||||
or any later version published by the Free Software Foundation;
|
or any later version published by the Free Software Foundation;
|
||||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
|
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
|
||||||
Texts. A copy of the license is included in the section entitled ``GNU
|
Texts. A copy of the license is included in the section entitled ``GNU
|
||||||
|
|||||||
+1
-1
@@ -19,7 +19,7 @@
|
|||||||
\def\finalout{\overfullrule=0pt}
|
\def\finalout{\overfullrule=0pt}
|
||||||
%\finalout
|
%\finalout
|
||||||
|
|
||||||
% Copyright (c) 1998, 2001, 2009-2011 Free Software Foundation, Inc.
|
% Copyright (c) 1998, 2001 Free Software Foundation, Inc.
|
||||||
%
|
%
|
||||||
% This file is part of Bison.
|
% This file is part of Bison.
|
||||||
%
|
%
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
Makefile
|
||||||
|
Makefile.in
|
||||||
|
bench.pl
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
/Makefile
|
|
||||||
/Makefile.in
|
|
||||||
/bench.pl
|
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
## Copyright (C) 2006, 2009-2011 Free Software Foundation, Inc.
|
## Copyright (C) 2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+1
-1
@@ -19,7 +19,7 @@ straightforward use of _build/src/bison would.)
|
|||||||
|
|
||||||
--
|
--
|
||||||
|
|
||||||
Copyright (C) 2006, 2009-2011 Free Software Foundation, Inc.
|
Copyright (C) 2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
|||||||
+6
-4
@@ -1,6 +1,6 @@
|
|||||||
#! /usr/bin/perl -w
|
#! /usr/bin/perl -w
|
||||||
|
|
||||||
# Copyright (C) 2006, 2008-2011 Free Software Foundation, Inc.
|
# Copyright (C) 2006, 2008 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This file is part of Bison, the GNU Compiler Compiler.
|
# This file is part of Bison, the GNU Compiler Compiler.
|
||||||
#
|
#
|
||||||
@@ -270,7 +270,9 @@ yylex (void)
|
|||||||
|
|
||||||
/* Skip white space. */
|
/* Skip white space. */
|
||||||
while ((c = get_char ()) == ' ' || c == '\t')
|
while ((c = get_char ()) == ' ' || c == '\t')
|
||||||
continue;
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/* process numbers */
|
/* process numbers */
|
||||||
if (c == '.' || isdigit (c))
|
if (c == '.' || isdigit (c))
|
||||||
@@ -343,8 +345,8 @@ sub bench_grammar ($)
|
|||||||
(
|
(
|
||||||
"pull-impure" => '',
|
"pull-impure" => '',
|
||||||
"pull-pure" => '%define api.pure',
|
"pull-pure" => '%define api.pure',
|
||||||
"push-impure" => '%define api.push-pull "both"',
|
"push-impure" => '%define api.push_pull "both"',
|
||||||
"push-pure" => '%define api.push-pull "both" %define api.pure',
|
"push-pure" => '%define api.push_pull "both" %define api.pure',
|
||||||
);
|
);
|
||||||
|
|
||||||
my %bench;
|
my %bench;
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
/Makefile
|
|
||||||
/Makefile.in
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
||||||
## Copyright (C) 2005, 2009-2011 Free Software Foundation, Inc.
|
## Copyright (C) 2005 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
*.cc
|
||||||
|
*.hh
|
||||||
|
*.ll
|
||||||
|
*.output
|
||||||
|
*.stamp
|
||||||
|
*.tmp
|
||||||
|
*.yy
|
||||||
|
.deps
|
||||||
|
Makefile
|
||||||
|
Makefile.in
|
||||||
|
calc++
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
/*.cc
|
|
||||||
/*.hh
|
|
||||||
/*.ll
|
|
||||||
/*.o
|
|
||||||
/*.output
|
|
||||||
/*.stamp
|
|
||||||
/*.tmp
|
|
||||||
/*.yy
|
|
||||||
/.deps
|
|
||||||
/Makefile
|
|
||||||
/Makefile.in
|
|
||||||
/calc++
|
|
||||||
/calc++.exe
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
||||||
## Copyright (C) 2005-2006, 2009-2011 Free Software Foundation, Inc.
|
## Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -31,16 +31,12 @@ $(BISON): $(BISON_IN)
|
|||||||
doc = $(top_srcdir)/doc/bison.texinfo
|
doc = $(top_srcdir)/doc/bison.texinfo
|
||||||
extexi = $(top_srcdir)/examples/extexi
|
extexi = $(top_srcdir)/examples/extexi
|
||||||
# Extract in src.
|
# Extract in src.
|
||||||
$(srcdir)/calc.stamp: $(doc) $(extexi)
|
$(calc_extracted): $(doc) $(extexi)
|
||||||
rm -f $@ $@.tmp
|
|
||||||
touch $@.tmp
|
|
||||||
cd $(srcdir) && \
|
cd $(srcdir) && \
|
||||||
$(AWK) -f ../extexi -v VERSION="$(VERSION)" \
|
$(AWK) -f ../extexi -v VERSION="$(VERSION)" \
|
||||||
../../doc/bison.texinfo -- calc++-parser.yy \
|
../../doc/bison.texinfo -- calc++-parser.yy \
|
||||||
calc++-scanner.ll calc++.cc calc++-driver.hh calc++-driver.cc
|
calc++-scanner.ll calc++.cc calc++-driver.hh calc++-driver.cc
|
||||||
mv $@.tmp $@
|
|
||||||
|
|
||||||
$(calc_extracted): $(srcdir)/calc.stamp
|
|
||||||
|
|
||||||
## ------------------- ##
|
## ------------------- ##
|
||||||
## Parser generation. ##
|
## Parser generation. ##
|
||||||
@@ -54,10 +50,7 @@ MAINTAINERCLEANFILES = $(srcdir)/*.stamp $(BUILT_SOURCES)
|
|||||||
# Compile the parser and save cycles.
|
# Compile the parser and save cycles.
|
||||||
# This code comes from "Handling Tools that Produce Many Outputs",
|
# This code comes from "Handling Tools that Produce Many Outputs",
|
||||||
# from the Automake documentation.
|
# from the Automake documentation.
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = $(srcdir)/calc++-parser.stamp $(srcdir)/calc++-parser.yy
|
||||||
$(srcdir)/calc++-parser.stamp \
|
|
||||||
$(srcdir)/calc++-parser.yy \
|
|
||||||
$(srcdir)/calc.stamp
|
|
||||||
# Don't depend on $(BISON) otherwise we would rebuild these files
|
# Don't depend on $(BISON) otherwise we would rebuild these files
|
||||||
# in srcdir, including during distcheck, which is forbidden.
|
# in srcdir, including during distcheck, which is forbidden.
|
||||||
$(srcdir)/calc++-parser.stamp: $(srcdir)/calc++-parser.yy $(BISON_IN)
|
$(srcdir)/calc++-parser.stamp: $(srcdir)/calc++-parser.yy $(BISON_IN)
|
||||||
|
|||||||
+1
-3
@@ -1,9 +1,7 @@
|
|||||||
# Extract all examples from the manual source. -*- AWK -*-
|
# Extract all examples from the manual source. -*- AWK -*-
|
||||||
|
|
||||||
# This file is part of GNU Bison
|
# This file is part of GNU Bison
|
||||||
|
# Copyright 1992, 2000, 2001, 2005, 2006 Free Software Foundation, Inc.
|
||||||
# Copyright (C) 1992, 2000-2001, 2005-2006, 2009-2011 Free Software
|
|
||||||
# Foundation, Inc.
|
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
external: gnulib
|
|
||||||
-1
Submodule gnulib deleted from eff4c0360a
+103
@@ -0,0 +1,103 @@
|
|||||||
|
.deps
|
||||||
|
Makefile
|
||||||
|
Makefile.in
|
||||||
|
argmatch.c
|
||||||
|
argmatch.h
|
||||||
|
basename.c
|
||||||
|
c-ctype.c
|
||||||
|
c-ctype.h
|
||||||
|
c-strcase.h
|
||||||
|
c-strcasecmp.c
|
||||||
|
c-strncasecmp.c
|
||||||
|
charset.alias
|
||||||
|
config.charset
|
||||||
|
config.h
|
||||||
|
config.hin
|
||||||
|
configmake.h
|
||||||
|
dirname.c
|
||||||
|
dirname.h
|
||||||
|
dup-safer.c
|
||||||
|
error.c
|
||||||
|
error.h
|
||||||
|
exitfail.c
|
||||||
|
exitfail.h
|
||||||
|
fd-safer.c
|
||||||
|
fopen-safer.c
|
||||||
|
getopt.c
|
||||||
|
getopt.h
|
||||||
|
getopt.in.h
|
||||||
|
getopt1.c
|
||||||
|
getopt_.h
|
||||||
|
getopt_int.h
|
||||||
|
gettext.h
|
||||||
|
gnulib.mk
|
||||||
|
hash.c
|
||||||
|
hash.h
|
||||||
|
intprops.h
|
||||||
|
inttypes.h
|
||||||
|
inttypes.in.h
|
||||||
|
inttypes_.h
|
||||||
|
localcharset.c
|
||||||
|
localcharset.h
|
||||||
|
malloc.c
|
||||||
|
mbswidth.c
|
||||||
|
mbswidth.h
|
||||||
|
obstack.c
|
||||||
|
obstack.h
|
||||||
|
pipe-safer.c
|
||||||
|
quote.c
|
||||||
|
quote.h
|
||||||
|
quotearg.c
|
||||||
|
quotearg.h
|
||||||
|
ref-add.sed
|
||||||
|
ref-add.sin
|
||||||
|
ref-del.sed
|
||||||
|
ref-del.sin
|
||||||
|
stamp-h1
|
||||||
|
stdbool.h
|
||||||
|
stdbool.in.h
|
||||||
|
stdbool_.h
|
||||||
|
stdint.h
|
||||||
|
stdint.in.h
|
||||||
|
stdint_.h
|
||||||
|
stdio--.h
|
||||||
|
stdio-safer.h
|
||||||
|
stdlib.h
|
||||||
|
stdlib.in.h
|
||||||
|
stdlib_.h
|
||||||
|
stpcpy.c
|
||||||
|
streq.h
|
||||||
|
strerror.c
|
||||||
|
string.h
|
||||||
|
string.in.h
|
||||||
|
string_.h
|
||||||
|
stripslash.c
|
||||||
|
strndup.c
|
||||||
|
strnlen.c
|
||||||
|
strtol.c
|
||||||
|
strtoul.c
|
||||||
|
strverscmp.c
|
||||||
|
strverscmp.h
|
||||||
|
unistd--.h
|
||||||
|
unistd-safer.h
|
||||||
|
unistd.h
|
||||||
|
unistd.in.h
|
||||||
|
unistd_.h
|
||||||
|
unitypes.h
|
||||||
|
uniwidth
|
||||||
|
uniwidth.h
|
||||||
|
unlocked-io.h
|
||||||
|
verify.h
|
||||||
|
wchar.h
|
||||||
|
wchar.in.h
|
||||||
|
wchar_.h
|
||||||
|
wctype.h
|
||||||
|
wctype.in.h
|
||||||
|
wctype_.h
|
||||||
|
wcwidth.c
|
||||||
|
wcwidth.h
|
||||||
|
xalloc-die.c
|
||||||
|
xalloc.h
|
||||||
|
xmalloc.c
|
||||||
|
xstrndup.c
|
||||||
|
xstrndup.h
|
||||||
-245
@@ -1,245 +0,0 @@
|
|||||||
|
|
||||||
/*.a
|
|
||||||
/*.bak
|
|
||||||
/*.o
|
|
||||||
/*~
|
|
||||||
/.deps
|
|
||||||
/.dirstamp
|
|
||||||
/Makefile
|
|
||||||
/Makefile.in
|
|
||||||
/alignof.h
|
|
||||||
/alloca.h
|
|
||||||
/alloca.in.h
|
|
||||||
/arg-nonnull.h
|
|
||||||
/argmatch.c
|
|
||||||
/argmatch.h
|
|
||||||
/asnprintf.c
|
|
||||||
/basename-lgpl.c
|
|
||||||
/basename.c
|
|
||||||
/binary-io.h
|
|
||||||
/bitrotate.h
|
|
||||||
/c++defs.h
|
|
||||||
/c-ctype.c
|
|
||||||
/c-ctype.h
|
|
||||||
/c-strcase.h
|
|
||||||
/c-strcasecmp.c
|
|
||||||
/c-strncasecmp.c
|
|
||||||
/calloc.c
|
|
||||||
/charset.alias
|
|
||||||
/cloexec.c
|
|
||||||
/cloexec.h
|
|
||||||
/close-hook.c
|
|
||||||
/close-hook.h
|
|
||||||
/close.c
|
|
||||||
/config.charset
|
|
||||||
/config.h
|
|
||||||
/config.hin
|
|
||||||
/configmake.h
|
|
||||||
/dirname-lgpl.c
|
|
||||||
/dirname.c
|
|
||||||
/dirname.h
|
|
||||||
/dosname.h
|
|
||||||
/dup-safer-flag.c
|
|
||||||
/dup-safer.c
|
|
||||||
/dup2.c
|
|
||||||
/errno.h
|
|
||||||
/errno.in.h
|
|
||||||
/error.c
|
|
||||||
/error.h
|
|
||||||
/exitfail.c
|
|
||||||
/exitfail.h
|
|
||||||
/fatal-signal.c
|
|
||||||
/fatal-signal.h
|
|
||||||
/fclose.c
|
|
||||||
/fcntl.c
|
|
||||||
/fcntl.h
|
|
||||||
/fcntl.in.h
|
|
||||||
/fd-safer-flag.c
|
|
||||||
/fd-safer.c
|
|
||||||
/float+.h
|
|
||||||
/float.h
|
|
||||||
/float.in.h
|
|
||||||
/fopen-safer.c
|
|
||||||
/fopen.c
|
|
||||||
/fprintf.c
|
|
||||||
/fpucw.h
|
|
||||||
/frexp.c
|
|
||||||
/frexpl.c
|
|
||||||
/fseterr.c
|
|
||||||
/fseterr.h
|
|
||||||
/getdtablesize.c
|
|
||||||
/getopt.c
|
|
||||||
/getopt.h
|
|
||||||
/getopt.in.h
|
|
||||||
/getopt1.c
|
|
||||||
/getopt_int.h
|
|
||||||
/gettext.h
|
|
||||||
/gnulib.mk
|
|
||||||
/hash.c
|
|
||||||
/hash.h
|
|
||||||
/intprops.h
|
|
||||||
/inttypes.h
|
|
||||||
/inttypes.in.h
|
|
||||||
/ioctl.c
|
|
||||||
/isnan.c
|
|
||||||
/isnand-nolibm.h
|
|
||||||
/isnand.c
|
|
||||||
/isnanf-nolibm.h
|
|
||||||
/isnanf.c
|
|
||||||
/isnanl-nolibm.h
|
|
||||||
/isnanl.c
|
|
||||||
/iswblank.c
|
|
||||||
/ldexpl.c
|
|
||||||
/localcharset.c
|
|
||||||
/localcharset.h
|
|
||||||
/malloc.c
|
|
||||||
/math.h
|
|
||||||
/math.in.h
|
|
||||||
/mbchar.c
|
|
||||||
/mbchar.h
|
|
||||||
/mbrtowc.c
|
|
||||||
/mbschr.c
|
|
||||||
/mbsinit.c
|
|
||||||
/mbsrchr.c
|
|
||||||
/mbswidth.c
|
|
||||||
/mbswidth.h
|
|
||||||
/mbuiter.h
|
|
||||||
/memchr.c
|
|
||||||
/memchr.valgrind
|
|
||||||
/nonblocking.c
|
|
||||||
/nonblocking.h
|
|
||||||
/obstack.c
|
|
||||||
/obstack.h
|
|
||||||
/open.c
|
|
||||||
/perror.c
|
|
||||||
/pipe-safer.c
|
|
||||||
/pipe.c
|
|
||||||
/pipe2-safer.c
|
|
||||||
/pipe2.c
|
|
||||||
/printf-args.c
|
|
||||||
/printf-args.h
|
|
||||||
/printf-frexp.c
|
|
||||||
/printf-frexp.h
|
|
||||||
/printf-frexpl.c
|
|
||||||
/printf-frexpl.h
|
|
||||||
/printf-parse.c
|
|
||||||
/printf-parse.h
|
|
||||||
/printf.c
|
|
||||||
/quote.c
|
|
||||||
/quote.h
|
|
||||||
/quotearg.c
|
|
||||||
/quotearg.h
|
|
||||||
/rawmemchr.c
|
|
||||||
/rawmemchr.valgrind
|
|
||||||
/realloc.c
|
|
||||||
/ref-add.sed
|
|
||||||
/ref-add.sin
|
|
||||||
/ref-del.sed
|
|
||||||
/ref-del.sin
|
|
||||||
/sched.h
|
|
||||||
/sched.in.h
|
|
||||||
/sig-handler.h
|
|
||||||
/sigaction.c
|
|
||||||
/signal.h
|
|
||||||
/signal.in.h
|
|
||||||
/signbitd.c
|
|
||||||
/signbitf.c
|
|
||||||
/signbitl.c
|
|
||||||
/sigprocmask.c
|
|
||||||
/size_max.h
|
|
||||||
/snprintf.c
|
|
||||||
/spawn-pipe.c
|
|
||||||
/spawn-pipe.h
|
|
||||||
/spawn.h
|
|
||||||
/spawn.in.h
|
|
||||||
/spawn_faction_addclose.c
|
|
||||||
/spawn_faction_adddup2.c
|
|
||||||
/spawn_faction_addopen.c
|
|
||||||
/spawn_faction_destroy.c
|
|
||||||
/spawn_faction_init.c
|
|
||||||
/spawn_int.h
|
|
||||||
/spawnattr_destroy.c
|
|
||||||
/spawnattr_init.c
|
|
||||||
/spawnattr_setflags.c
|
|
||||||
/spawnattr_setsigmask.c
|
|
||||||
/spawni.c
|
|
||||||
/spawnp.c
|
|
||||||
/sprintf.c
|
|
||||||
/stamp-h1
|
|
||||||
/stat.c
|
|
||||||
/stdbool.h
|
|
||||||
/stdbool.in.h
|
|
||||||
/stddef.h
|
|
||||||
/stddef.in.h
|
|
||||||
/stdint.h
|
|
||||||
/stdint.in.h
|
|
||||||
/stdio--.h
|
|
||||||
/stdio-impl.h
|
|
||||||
/stdio-safer.h
|
|
||||||
/stdio-write.c
|
|
||||||
/stdio.h
|
|
||||||
/stdio.in.h
|
|
||||||
/stdlib.h
|
|
||||||
/stdlib.in.h
|
|
||||||
/stpcpy.c
|
|
||||||
/strchrnul.c
|
|
||||||
/strchrnul.valgrind
|
|
||||||
/strdup.c
|
|
||||||
/streq.h
|
|
||||||
/strerror.c
|
|
||||||
/string.h
|
|
||||||
/string.in.h
|
|
||||||
/stripslash.c
|
|
||||||
/strndup.c
|
|
||||||
/strnlen.c
|
|
||||||
/strnlen1.c
|
|
||||||
/strnlen1.h
|
|
||||||
/strtol.c
|
|
||||||
/strtoul.c
|
|
||||||
/strverscmp.c
|
|
||||||
/sys
|
|
||||||
/sys_ioctl.h
|
|
||||||
/sys_ioctl.in.h
|
|
||||||
/sys_socket.h
|
|
||||||
/sys_socket.in.h
|
|
||||||
/sys_stat.h
|
|
||||||
/sys_stat.in.h
|
|
||||||
/sys_wait.h
|
|
||||||
/sys_wait.in.h
|
|
||||||
/time.h
|
|
||||||
/time.in.h
|
|
||||||
/unistd--.h
|
|
||||||
/unistd-safer.h
|
|
||||||
/unistd.h
|
|
||||||
/unistd.in.h
|
|
||||||
/unitypes.h
|
|
||||||
/unitypes.in.h
|
|
||||||
/uniwidth
|
|
||||||
/uniwidth.h
|
|
||||||
/uniwidth.in.h
|
|
||||||
/unlocked-io.h
|
|
||||||
/unsetenv.c
|
|
||||||
/vasnprintf.c
|
|
||||||
/vasnprintf.h
|
|
||||||
/verify.h
|
|
||||||
/vfprintf.c
|
|
||||||
/vsnprintf.c
|
|
||||||
/vsprintf.c
|
|
||||||
/w32sock.h
|
|
||||||
/w32spawn.h
|
|
||||||
/wait-process.c
|
|
||||||
/wait-process.h
|
|
||||||
/waitpid.c
|
|
||||||
/warn-on-use.h
|
|
||||||
/wchar.h
|
|
||||||
/wchar.in.h
|
|
||||||
/wctype.h
|
|
||||||
/wctype.in.h
|
|
||||||
/wcwidth.c
|
|
||||||
/xalloc-die.c
|
|
||||||
/xalloc.h
|
|
||||||
/xmalloc.c
|
|
||||||
/xsize.h
|
|
||||||
/xstrndup.c
|
|
||||||
/xstrndup.h
|
|
||||||
|
|
||||||
+3
-3
@@ -1,7 +1,6 @@
|
|||||||
# Make bison/lib.
|
# Make bison/lib.
|
||||||
|
|
||||||
# Copyright (C) 2001-2004, 2006, 2008-2011 Free Software Foundation,
|
# Copyright (C) 2001, 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
|
||||||
# Inc.
|
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -18,7 +17,7 @@
|
|||||||
|
|
||||||
include gnulib.mk
|
include gnulib.mk
|
||||||
|
|
||||||
AM_CFLAGS += $(WARN_CFLAGS)
|
AM_CFLAGS = $(WARNING_CFLAGS)
|
||||||
|
|
||||||
# Implementation of bitsets.
|
# Implementation of bitsets.
|
||||||
bitsets_sources = \
|
bitsets_sources = \
|
||||||
@@ -37,6 +36,7 @@ timevars_sources = \
|
|||||||
# Non-gnulib sources in Bison's internal library.
|
# Non-gnulib sources in Bison's internal library.
|
||||||
libbison_a_SOURCES += \
|
libbison_a_SOURCES += \
|
||||||
get-errno.h get-errno.c \
|
get-errno.h get-errno.c \
|
||||||
|
subpipe.h subpipe.c \
|
||||||
$(bitsets_sources) $(additional_bitsets_sources) $(timevars_sources)
|
$(bitsets_sources) $(additional_bitsets_sources) $(timevars_sources)
|
||||||
|
|
||||||
# The Yacc compatibility library.
|
# The Yacc compatibility library.
|
||||||
|
|||||||
+15
-13
@@ -1,13 +1,10 @@
|
|||||||
/* Array bitsets.
|
/* Array bitsets.
|
||||||
|
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
|
||||||
Copyright (C) 2002-2003, 2006, 2009-2011 Free Software Foundation,
|
|
||||||
Inc.
|
|
||||||
|
|
||||||
Contributed by Michael Hayes ([email protected]).
|
Contributed by Michael Hayes ([email protected]).
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
@@ -16,9 +13,13 @@
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "abitset.h"
|
#include "abitset.h"
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
@@ -33,13 +34,14 @@
|
|||||||
|
|
||||||
|
|
||||||
static bitset_bindex
|
static bitset_bindex
|
||||||
abitset_resize (bitset src, bitset_bindex size)
|
abitset_resize (bitset src ATTRIBUTE_UNUSED,
|
||||||
|
bitset_bindex size ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
/* These bitsets have a fixed size. */
|
if (BITSET_SIZE_ (src) == size)
|
||||||
if (BITSET_SIZE_ (src) != size)
|
return size;
|
||||||
abort ();
|
|
||||||
|
|
||||||
return size;
|
/* These bitsets have a fixed size. */
|
||||||
|
abort ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find list of up to NUM bits set in BSET starting from and including
|
/* Find list of up to NUM bits set in BSET starting from and including
|
||||||
|
|||||||
+15
-16
@@ -1,29 +1,28 @@
|
|||||||
/* Functions to support abitsets.
|
/* Functions to support abitsets.
|
||||||
|
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||||
Copyright (C) 2002, 2004, 2009-2011 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#ifndef _ABITSET_H
|
#ifndef _ABITSET_H
|
||||||
#define _ABITSET_H
|
#define _ABITSET_H
|
||||||
|
|
||||||
#include "bitset.h"
|
#include "bitset.h"
|
||||||
|
|
||||||
extern size_t abitset_bytes (bitset_bindex);
|
extern size_t abitset_bytes PARAMS ((bitset_bindex));
|
||||||
|
|
||||||
extern bitset abitset_init (bitset, bitset_bindex);
|
extern bitset abitset_init PARAMS ((bitset, bitset_bindex));
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+66
-66
@@ -1,31 +1,30 @@
|
|||||||
/* Base bitset stuff.
|
/* Base bitset stuff.
|
||||||
|
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
|
||||||
Copyright (C) 2002-2004, 2006, 2009-2011 Free Software Foundation,
|
|
||||||
Inc.
|
|
||||||
|
|
||||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#ifndef _BBITSET_H
|
#ifndef _BBITSET_H
|
||||||
#define _BBITSET_H
|
#define _BBITSET_H
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
#include "libiberty.h"
|
#include "libiberty.h"
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <stddef.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
/* Currently we support five flavours of bitsets:
|
/* Currently we support five flavours of bitsets:
|
||||||
BITSET_ARRAY: Array of bits (fixed size, fast for dense bitsets).
|
BITSET_ARRAY: Array of bits (fixed size, fast for dense bitsets).
|
||||||
@@ -36,7 +35,7 @@
|
|||||||
BITSET_TABLE: Expandable table of pointers to arrays of bits
|
BITSET_TABLE: Expandable table of pointers to arrays of bits
|
||||||
(variable size, less storage for large sparse sets).
|
(variable size, less storage for large sparse sets).
|
||||||
Faster than BITSET_LIST for random access.
|
Faster than BITSET_LIST for random access.
|
||||||
BITSET_VARRAY: Variable array of bits (variable size, fast for
|
BITSET_VARRAY: Variable array of bits (variable size, fast for
|
||||||
dense bitsets).
|
dense bitsets).
|
||||||
BITSET_STATS: Wrapper bitset for internal use only. Used for gathering
|
BITSET_STATS: Wrapper bitset for internal use only. Used for gathering
|
||||||
statistics and/or better run-time checking.
|
statistics and/or better run-time checking.
|
||||||
@@ -50,8 +49,8 @@ extern const char * const bitset_type_names[];
|
|||||||
enum bitset_alloc_type {BITSET_MALLOC, BITSET_OBALLOC};
|
enum bitset_alloc_type {BITSET_MALLOC, BITSET_OBALLOC};
|
||||||
|
|
||||||
/* Data type used to store a word of bits. */
|
/* Data type used to store a word of bits. */
|
||||||
typedef unsigned long int bitset_word;
|
typedef unsigned long bitset_word;
|
||||||
#define BITSET_WORD_BITS ((unsigned int) (CHAR_BIT * sizeof (bitset_word)))
|
#define BITSET_WORD_BITS ((unsigned) (CHAR_BIT * sizeof (bitset_word)))
|
||||||
|
|
||||||
/* Bit index. In theory we might need a type wider than size_t, but
|
/* Bit index. In theory we might need a type wider than size_t, but
|
||||||
in practice we lose at most a factor of CHAR_BIT by going with
|
in practice we lose at most a factor of CHAR_BIT by going with
|
||||||
@@ -113,45 +112,46 @@ typedef union bitset_union *bitset;
|
|||||||
/* The contents of this structure should be considered private. */
|
/* The contents of this structure should be considered private. */
|
||||||
struct bitset_vtable
|
struct bitset_vtable
|
||||||
{
|
{
|
||||||
void (*set) (bitset, bitset_bindex);
|
void (*set) PARAMS ((bitset, bitset_bindex));
|
||||||
void (*reset) (bitset, bitset_bindex);
|
void (*reset) PARAMS ((bitset, bitset_bindex));
|
||||||
bool (*toggle) (bitset, bitset_bindex);
|
bool (*toggle) PARAMS ((bitset, bitset_bindex));
|
||||||
bool (*test) (bitset, bitset_bindex);
|
bool (*test) PARAMS ((bitset, bitset_bindex));
|
||||||
bitset_bindex (*resize) (bitset, bitset_bindex);
|
bitset_bindex (*resize) PARAMS ((bitset, bitset_bindex));
|
||||||
bitset_bindex (*size) (bitset);
|
bitset_bindex (*size) PARAMS ((bitset));
|
||||||
bitset_bindex (*count) (bitset);
|
bitset_bindex (*count) PARAMS ((bitset));
|
||||||
|
|
||||||
bool (*empty_p) (bitset);
|
bool (*empty_p) PARAMS ((bitset));
|
||||||
void (*ones) (bitset);
|
void (*ones) PARAMS ((bitset));
|
||||||
void (*zero) (bitset);
|
void (*zero) PARAMS ((bitset));
|
||||||
|
|
||||||
void (*copy) (bitset, bitset);
|
void (*copy) PARAMS ((bitset, bitset));
|
||||||
bool (*disjoint_p) (bitset, bitset);
|
bool (*disjoint_p) PARAMS ((bitset, bitset));
|
||||||
bool (*equal_p) (bitset, bitset);
|
bool (*equal_p) PARAMS ((bitset, bitset));
|
||||||
void (*not_) (bitset, bitset);
|
void (*not) PARAMS ((bitset, bitset));
|
||||||
bool (*subset_p) (bitset, bitset);
|
bool (*subset_p) PARAMS ((bitset, bitset));
|
||||||
|
|
||||||
void (*and_) (bitset, bitset, bitset);
|
void (*and) PARAMS ((bitset, bitset, bitset));
|
||||||
bool (*and_cmp) (bitset, bitset, bitset);
|
bool (*and_cmp) PARAMS ((bitset, bitset, bitset));
|
||||||
void (*andn) (bitset, bitset, bitset);
|
void (*andn) PARAMS ((bitset, bitset, bitset));
|
||||||
bool (*andn_cmp) (bitset, bitset, bitset);
|
bool (*andn_cmp) PARAMS ((bitset, bitset, bitset));
|
||||||
void (*or_) (bitset, bitset, bitset);
|
void (*or) PARAMS ((bitset, bitset, bitset));
|
||||||
bool (*or_cmp) (bitset, bitset, bitset);
|
bool (*or_cmp) PARAMS ((bitset, bitset, bitset));
|
||||||
void (*xor_) (bitset, bitset, bitset);
|
void (*xor) PARAMS ((bitset, bitset, bitset));
|
||||||
bool (*xor_cmp) (bitset, bitset, bitset);
|
bool (*xor_cmp) PARAMS ((bitset, bitset, bitset));
|
||||||
|
|
||||||
void (*and_or) (bitset, bitset, bitset, bitset);
|
void (*and_or) PARAMS ((bitset, bitset, bitset, bitset));
|
||||||
bool (*and_or_cmp) (bitset, bitset, bitset, bitset);
|
bool (*and_or_cmp) PARAMS ((bitset, bitset, bitset, bitset));
|
||||||
void (*andn_or) (bitset, bitset, bitset, bitset);
|
void (*andn_or) PARAMS ((bitset, bitset, bitset, bitset));
|
||||||
bool (*andn_or_cmp) (bitset, bitset, bitset, bitset);
|
bool (*andn_or_cmp) PARAMS ((bitset, bitset, bitset, bitset));
|
||||||
void (*or_and) (bitset, bitset, bitset, bitset);
|
void (*or_and) PARAMS ((bitset, bitset, bitset, bitset));
|
||||||
bool (*or_and_cmp) (bitset, bitset, bitset, bitset);
|
bool (*or_and_cmp) PARAMS ((bitset, bitset, bitset, bitset));
|
||||||
|
|
||||||
bitset_bindex (*list) (bitset, bitset_bindex *, bitset_bindex,
|
bitset_bindex (*list) PARAMS ((bitset, bitset_bindex *,
|
||||||
bitset_bindex *);
|
bitset_bindex, bitset_bindex *));
|
||||||
bitset_bindex (*list_reverse) (bitset, bitset_bindex *, bitset_bindex,
|
bitset_bindex (*list_reverse) PARAMS ((bitset,
|
||||||
bitset_bindex *);
|
bitset_bindex *, bitset_bindex,
|
||||||
void (*free) (bitset);
|
bitset_bindex *));
|
||||||
|
void (*free) PARAMS ((bitset));
|
||||||
enum bitset_type type;
|
enum bitset_type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -220,14 +220,14 @@ if (!BITSET_COMPATIBLE_ (DST, SRC1) || !BITSET_COMPATIBLE_ (DST, SRC2) \
|
|||||||
#define BITSET_EQUAL_P_(DST, SRC) (SRC)->b.vtable->equal_p (DST, SRC)
|
#define BITSET_EQUAL_P_(DST, SRC) (SRC)->b.vtable->equal_p (DST, SRC)
|
||||||
|
|
||||||
/* DST = ~SRC. */
|
/* DST = ~SRC. */
|
||||||
#define BITSET_NOT_(DST, SRC) (SRC)->b.vtable->not_ (DST, SRC)
|
#define BITSET_NOT_(DST, SRC) (SRC)->b.vtable->not (DST, SRC)
|
||||||
|
|
||||||
/* Return DST == DST | SRC. */
|
/* Return DST == DST | SRC. */
|
||||||
#define BITSET_SUBSET_P_(DST, SRC) (SRC)->b.vtable->subset_p (DST, SRC)
|
#define BITSET_SUBSET_P_(DST, SRC) (SRC)->b.vtable->subset_p (DST, SRC)
|
||||||
|
|
||||||
|
|
||||||
/* DST = SRC1 & SRC2. */
|
/* DST = SRC1 & SRC2. */
|
||||||
#define BITSET_AND_(DST, SRC1, SRC2) (SRC1)->b.vtable->and_ (DST, SRC1, SRC2)
|
#define BITSET_AND_(DST, SRC1, SRC2) (SRC1)->b.vtable->and (DST, SRC1, SRC2)
|
||||||
#define BITSET_AND_CMP_(DST, SRC1, SRC2) (SRC1)->b.vtable->and_cmp (DST, SRC1, SRC2)
|
#define BITSET_AND_CMP_(DST, SRC1, SRC2) (SRC1)->b.vtable->and_cmp (DST, SRC1, SRC2)
|
||||||
|
|
||||||
/* DST = SRC1 & ~SRC2. */
|
/* DST = SRC1 & ~SRC2. */
|
||||||
@@ -235,11 +235,11 @@ if (!BITSET_COMPATIBLE_ (DST, SRC1) || !BITSET_COMPATIBLE_ (DST, SRC2) \
|
|||||||
#define BITSET_ANDN_CMP_(DST, SRC1, SRC2) (SRC1)->b.vtable->andn_cmp (DST, SRC1, SRC2)
|
#define BITSET_ANDN_CMP_(DST, SRC1, SRC2) (SRC1)->b.vtable->andn_cmp (DST, SRC1, SRC2)
|
||||||
|
|
||||||
/* DST = SRC1 | SRC2. */
|
/* DST = SRC1 | SRC2. */
|
||||||
#define BITSET_OR_(DST, SRC1, SRC2) (SRC1)->b.vtable->or_ (DST, SRC1, SRC2)
|
#define BITSET_OR_(DST, SRC1, SRC2) (SRC1)->b.vtable->or (DST, SRC1, SRC2)
|
||||||
#define BITSET_OR_CMP_(DST, SRC1, SRC2) (SRC1)->b.vtable->or_cmp (DST, SRC1, SRC2)
|
#define BITSET_OR_CMP_(DST, SRC1, SRC2) (SRC1)->b.vtable->or_cmp (DST, SRC1, SRC2)
|
||||||
|
|
||||||
/* DST = SRC1 ^ SRC2. */
|
/* DST = SRC1 ^ SRC2. */
|
||||||
#define BITSET_XOR_(DST, SRC1, SRC2) (SRC1)->b.vtable->xor_ (DST, SRC1, SRC2)
|
#define BITSET_XOR_(DST, SRC1, SRC2) (SRC1)->b.vtable->xor (DST, SRC1, SRC2)
|
||||||
#define BITSET_XOR_CMP_(DST, SRC1, SRC2) (SRC1)->b.vtable->xor_cmp (DST, SRC1, SRC2)
|
#define BITSET_XOR_CMP_(DST, SRC1, SRC2) (SRC1)->b.vtable->xor_cmp (DST, SRC1, SRC2)
|
||||||
|
|
||||||
|
|
||||||
@@ -281,24 +281,24 @@ if (!BITSET_COMPATIBLE_ (DST, SRC1) || !BITSET_COMPATIBLE_ (DST, SRC2) \
|
|||||||
|
|
||||||
/* Private functions for bitset implementations. */
|
/* Private functions for bitset implementations. */
|
||||||
|
|
||||||
extern bool bitset_toggle_ (bitset, bitset_bindex);
|
extern bool bitset_toggle_ PARAMS ((bitset, bitset_bindex));
|
||||||
|
|
||||||
extern bitset_bindex bitset_count_ (bitset);
|
extern bitset_bindex bitset_count_ PARAMS ((bitset));
|
||||||
|
|
||||||
extern bitset_bindex bitset_size_ (bitset);
|
extern bitset_bindex bitset_size_ PARAMS ((bitset));
|
||||||
|
|
||||||
extern bool bitset_copy_ (bitset, bitset);
|
extern bool bitset_copy_ PARAMS ((bitset, bitset));
|
||||||
|
|
||||||
extern void bitset_and_or_ (bitset, bitset, bitset, bitset);
|
extern void bitset_and_or_ PARAMS ((bitset, bitset, bitset, bitset));
|
||||||
|
|
||||||
extern bool bitset_and_or_cmp_ (bitset, bitset, bitset, bitset);
|
extern bool bitset_and_or_cmp_ PARAMS ((bitset, bitset, bitset, bitset));
|
||||||
|
|
||||||
extern void bitset_andn_or_ (bitset, bitset, bitset, bitset);
|
extern void bitset_andn_or_ PARAMS ((bitset, bitset, bitset, bitset));
|
||||||
|
|
||||||
extern bool bitset_andn_or_cmp_ (bitset, bitset, bitset, bitset);
|
extern bool bitset_andn_or_cmp_ PARAMS ((bitset, bitset, bitset, bitset));
|
||||||
|
|
||||||
extern void bitset_or_and_ (bitset, bitset, bitset, bitset);
|
extern void bitset_or_and_ PARAMS ((bitset, bitset, bitset, bitset));
|
||||||
|
|
||||||
extern bool bitset_or_and_cmp_ (bitset, bitset, bitset, bitset);
|
extern bool bitset_or_and_cmp_ PARAMS ((bitset, bitset, bitset, bitset));
|
||||||
|
|
||||||
#endif /* _BBITSET_H */
|
#endif /* _BBITSET_H */
|
||||||
|
|||||||
+22
-22
@@ -1,12 +1,10 @@
|
|||||||
/* General bitsets.
|
/* General bitsets.
|
||||||
|
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
|
||||||
Copyright (C) 2002-2006, 2009-2011 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
@@ -15,14 +13,16 @@
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <config.h>
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
#include "bitset.h"
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "bitset.h"
|
||||||
#include "abitset.h"
|
#include "abitset.h"
|
||||||
#include "lbitset.h"
|
#include "lbitset.h"
|
||||||
#include "ebitset.h"
|
#include "ebitset.h"
|
||||||
@@ -45,9 +45,6 @@ bitset_bytes (enum bitset_type type, bitset_bindex n_bits)
|
|||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
default:
|
|
||||||
abort ();
|
|
||||||
|
|
||||||
case BITSET_ARRAY:
|
case BITSET_ARRAY:
|
||||||
bytes = abitset_bytes (n_bits);
|
bytes = abitset_bytes (n_bits);
|
||||||
break;
|
break;
|
||||||
@@ -63,6 +60,9 @@ bitset_bytes (enum bitset_type type, bitset_bindex n_bits)
|
|||||||
case BITSET_VARRAY:
|
case BITSET_VARRAY:
|
||||||
bytes = vbitset_bytes (n_bits);
|
bytes = vbitset_bytes (n_bits);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
abort ();
|
||||||
}
|
}
|
||||||
|
|
||||||
return bytes;
|
return bytes;
|
||||||
@@ -78,9 +78,6 @@ bitset_init (bitset bset, bitset_bindex n_bits, enum bitset_type type)
|
|||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
default:
|
|
||||||
abort ();
|
|
||||||
|
|
||||||
case BITSET_ARRAY:
|
case BITSET_ARRAY:
|
||||||
return abitset_init (bset, n_bits);
|
return abitset_init (bset, n_bits);
|
||||||
|
|
||||||
@@ -92,6 +89,9 @@ bitset_init (bitset bset, bitset_bindex n_bits, enum bitset_type type)
|
|||||||
|
|
||||||
case BITSET_VARRAY:
|
case BITSET_VARRAY:
|
||||||
return vbitset_init (bset, n_bits);
|
return vbitset_init (bset, n_bits);
|
||||||
|
|
||||||
|
default:
|
||||||
|
abort ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,7 +111,7 @@ bitset_type_choose (bitset_bindex n_bits ATTRIBUTE_UNUSED, unsigned int attr)
|
|||||||
/* Choose the type of bitset. Note that sometimes we will be asked
|
/* Choose the type of bitset. Note that sometimes we will be asked
|
||||||
for a zero length fixed size bitset. */
|
for a zero length fixed size bitset. */
|
||||||
|
|
||||||
|
|
||||||
/* If no attributes selected, choose a good compromise. */
|
/* If no attributes selected, choose a good compromise. */
|
||||||
if (!attr)
|
if (!attr)
|
||||||
return BITSET_VARRAY;
|
return BITSET_VARRAY;
|
||||||
@@ -138,7 +138,7 @@ bitset_alloc (bitset_bindex n_bits, enum bitset_type type)
|
|||||||
|
|
||||||
bytes = bitset_bytes (type, n_bits);
|
bytes = bitset_bytes (type, n_bits);
|
||||||
|
|
||||||
bset = xcalloc (1, bytes);
|
bset = (bitset) xcalloc (1, bytes);
|
||||||
|
|
||||||
/* The cache is disabled until some elements are allocated. If we
|
/* The cache is disabled until some elements are allocated. If we
|
||||||
have variable length arrays, then we may need to allocate a dummy
|
have variable length arrays, then we may need to allocate a dummy
|
||||||
@@ -296,7 +296,7 @@ bitset_print (FILE *file, bitset bset, bool verbose)
|
|||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
fprintf (file, "n_bits = %lu, set = {",
|
fprintf (file, "n_bits = %lu, set = {",
|
||||||
(unsigned long int) bitset_size (bset));
|
(unsigned long) bitset_size (bset));
|
||||||
|
|
||||||
pos = 30;
|
pos = 30;
|
||||||
BITSET_FOR_EACH (iter, bset, i, 0)
|
BITSET_FOR_EACH (iter, bset, i, 0)
|
||||||
@@ -307,7 +307,7 @@ bitset_print (FILE *file, bitset bset, bool verbose)
|
|||||||
pos = 0;
|
pos = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf (file, "%lu ", (unsigned long int) i);
|
fprintf (file, "%d ", i);
|
||||||
pos += 1 + (i >= 10) + (i >= 100);
|
pos += 1 + (i >= 10) + (i >= 100);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -421,9 +421,6 @@ bitset_op4_cmp (bitset dst, bitset src1, bitset src2, bitset src3,
|
|||||||
|
|
||||||
switch (op)
|
switch (op)
|
||||||
{
|
{
|
||||||
default:
|
|
||||||
abort ();
|
|
||||||
|
|
||||||
case BITSET_OP_OR_AND:
|
case BITSET_OP_OR_AND:
|
||||||
bitset_or (tmp, src1, src2);
|
bitset_or (tmp, src1, src2);
|
||||||
changed = bitset_and_cmp (dst, src3, tmp);
|
changed = bitset_and_cmp (dst, src3, tmp);
|
||||||
@@ -438,6 +435,9 @@ bitset_op4_cmp (bitset dst, bitset src1, bitset src2, bitset src3,
|
|||||||
bitset_andn (tmp, src1, src2);
|
bitset_andn (tmp, src1, src2);
|
||||||
changed = bitset_or_cmp (dst, src3, tmp);
|
changed = bitset_or_cmp (dst, src3, tmp);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
abort ();
|
||||||
}
|
}
|
||||||
|
|
||||||
bitset_free (tmp);
|
bitset_free (tmp);
|
||||||
|
|||||||
+62
-54
@@ -1,21 +1,20 @@
|
|||||||
/* Generic bitsets.
|
/* Generic bitsets.
|
||||||
|
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
|
||||||
Copyright (C) 2002-2004, 2009-2011 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#ifndef _BITSET_H
|
#ifndef _BITSET_H
|
||||||
#define _BITSET_H
|
#define _BITSET_H
|
||||||
@@ -24,12 +23,18 @@
|
|||||||
Only use the functions and macros defined in this file. */
|
Only use the functions and macros defined in this file. */
|
||||||
|
|
||||||
#include "bbitset.h"
|
#include "bbitset.h"
|
||||||
#include "obstack.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#if USE_UNLOCKED_IO
|
/* obstack.h tries to be portable to K&R compilers, but its
|
||||||
# include "unlocked-io.h"
|
__INT_TO_PTR macro generates diagnostics on compilers like Tru64 cc
|
||||||
|
that define __STDC__ to 0 when not in strict ANSI mode. The bitset
|
||||||
|
code assumes C89 or later, so it can avoid these glitches by
|
||||||
|
defining __INT_TO_PTR appropriately for C89 or later. */
|
||||||
|
#ifndef __INT_TO_PTR
|
||||||
|
# define __INT_TO_PTR(P) ((void *) ((P) + (char *) 0))
|
||||||
#endif
|
#endif
|
||||||
|
#include "obstack.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
/* Attributes used to select a bitset implementation. */
|
/* Attributes used to select a bitset implementation. */
|
||||||
enum bitset_attr {BITSET_FIXED = 1, /* Bitset size fixed. */
|
enum bitset_attr {BITSET_FIXED = 1, /* Bitset size fixed. */
|
||||||
@@ -98,37 +103,38 @@ typedef struct
|
|||||||
|
|
||||||
|
|
||||||
/* Return bytes required for bitset of desired type and size. */
|
/* Return bytes required for bitset of desired type and size. */
|
||||||
extern size_t bitset_bytes (enum bitset_type, bitset_bindex);
|
extern size_t bitset_bytes PARAMS ((enum bitset_type, bitset_bindex));
|
||||||
|
|
||||||
/* Initialise a bitset with desired type and size. */
|
/* Initialise a bitset with desired type and size. */
|
||||||
extern bitset bitset_init (bitset, bitset_bindex, enum bitset_type);
|
extern bitset bitset_init PARAMS ((bitset, bitset_bindex, enum bitset_type));
|
||||||
|
|
||||||
/* Select an implementation type based on the desired bitset size
|
/* Select an implementation type based on the desired bitset size
|
||||||
and attributes. */
|
and attributes. */
|
||||||
extern enum bitset_type bitset_type_choose (bitset_bindex, bitset_attrs);
|
extern enum bitset_type bitset_type_choose PARAMS ((bitset_bindex,
|
||||||
|
bitset_attrs));
|
||||||
|
|
||||||
/* Create a bitset of desired type and size. The bitset is zeroed. */
|
/* Create a bitset of desired type and size. The bitset is zeroed. */
|
||||||
extern bitset bitset_alloc (bitset_bindex, enum bitset_type);
|
extern bitset bitset_alloc PARAMS ((bitset_bindex, enum bitset_type));
|
||||||
|
|
||||||
/* Free bitset. */
|
/* Free bitset. */
|
||||||
extern void bitset_free (bitset);
|
extern void bitset_free PARAMS ((bitset));
|
||||||
|
|
||||||
/* Create a bitset of desired type and size using an obstack. The
|
/* Create a bitset of desired type and size using an obstack. The
|
||||||
bitset is zeroed. */
|
bitset is zeroed. */
|
||||||
extern bitset bitset_obstack_alloc (struct obstack *bobstack,
|
extern bitset bitset_obstack_alloc PARAMS ((struct obstack *bobstack,
|
||||||
bitset_bindex, enum bitset_type);
|
bitset_bindex, enum bitset_type));
|
||||||
|
|
||||||
/* Free bitset allocated on obstack. */
|
/* Free bitset allocated on obstack. */
|
||||||
extern void bitset_obstack_free (bitset);
|
extern void bitset_obstack_free PARAMS ((bitset));
|
||||||
|
|
||||||
/* Create a bitset of desired size and attributes. The bitset is zeroed. */
|
/* Create a bitset of desired size and attributes. The bitset is zeroed. */
|
||||||
extern bitset bitset_create (bitset_bindex, bitset_attrs);
|
extern bitset bitset_create PARAMS ((bitset_bindex, bitset_attrs));
|
||||||
|
|
||||||
/* Return bitset type. */
|
/* Return bitset type. */
|
||||||
extern enum bitset_type bitset_type_get (bitset);
|
extern enum bitset_type bitset_type_get PARAMS ((bitset));
|
||||||
|
|
||||||
/* Return bitset type name. */
|
/* Return bitset type name. */
|
||||||
extern const char *bitset_type_name_get (bitset);
|
extern const char *bitset_type_name_get PARAMS ((bitset));
|
||||||
|
|
||||||
|
|
||||||
/* Set bit BITNO in bitset BSET. */
|
/* Set bit BITNO in bitset BSET. */
|
||||||
@@ -180,7 +186,7 @@ bitset_test (bitset bset, bitset_bindex bitno)
|
|||||||
#define bitset_size(SRC) BITSET_SIZE_ (SRC)
|
#define bitset_size(SRC) BITSET_SIZE_ (SRC)
|
||||||
|
|
||||||
/* Change size of bitset. */
|
/* Change size of bitset. */
|
||||||
extern void bitset_resize (bitset, bitset_bindex);
|
extern void bitset_resize PARAMS ((bitset, bitset_bindex));
|
||||||
|
|
||||||
/* Return number of bits set in bitset SRC. */
|
/* Return number of bits set in bitset SRC. */
|
||||||
#define bitset_count(SRC) BITSET_COUNT_ (SRC)
|
#define bitset_count(SRC) BITSET_COUNT_ (SRC)
|
||||||
@@ -280,42 +286,43 @@ extern void bitset_resize (bitset, bitset_bindex);
|
|||||||
BITSET_LIST_REVERSE_ (BSET, LIST, NUM, NEXT)
|
BITSET_LIST_REVERSE_ (BSET, LIST, NUM, NEXT)
|
||||||
|
|
||||||
/* Return true if both bitsets are of the same type and size. */
|
/* Return true if both bitsets are of the same type and size. */
|
||||||
extern bool bitset_compatible_p (bitset bset1, bitset bset2);
|
extern bool
|
||||||
|
bitset_compatible_p (bitset bset1, bitset bset2);
|
||||||
|
|
||||||
/* Find next set bit from the given bit index. */
|
/* Find next set bit from the given bit index. */
|
||||||
extern bitset_bindex bitset_next (bitset, bitset_bindex);
|
extern bitset_bindex bitset_next PARAMS ((bitset, bitset_bindex));
|
||||||
|
|
||||||
/* Find previous set bit from the given bit index. */
|
/* Find previous set bit from the given bit index. */
|
||||||
extern bitset_bindex bitset_prev (bitset, bitset_bindex);
|
extern bitset_bindex bitset_prev PARAMS ((bitset, bitset_bindex));
|
||||||
|
|
||||||
/* Find first set bit. */
|
/* Find first set bit. */
|
||||||
extern bitset_bindex bitset_first (bitset);
|
extern bitset_bindex bitset_first PARAMS ((bitset));
|
||||||
|
|
||||||
/* Find last set bit. */
|
/* Find last set bit. */
|
||||||
extern bitset_bindex bitset_last (bitset);
|
extern bitset_bindex bitset_last PARAMS ((bitset));
|
||||||
|
|
||||||
/* Return nonzero if this is the only set bit. */
|
/* Return nonzero if this is the only set bit. */
|
||||||
extern bool bitset_only_set_p (bitset, bitset_bindex);
|
extern bool bitset_only_set_p PARAMS ((bitset, bitset_bindex));
|
||||||
|
|
||||||
/* Dump bitset. */
|
/* Dump bitset. */
|
||||||
extern void bitset_dump (FILE *, bitset);
|
extern void bitset_dump PARAMS ((FILE *, bitset));
|
||||||
|
|
||||||
/* Loop over all elements of BSET, starting with MIN, setting INDEX
|
/* Loop over all elements of BSET, starting with MIN, setting INDEX
|
||||||
to the index of each set bit. For example, the following will print
|
to the index of each set bit. For example, the following will print
|
||||||
the bits set in a bitset:
|
the bits set in a bitset:
|
||||||
|
|
||||||
bitset_bindex i;
|
bitset_bindex index;
|
||||||
bitset_iterator iter;
|
bitset_iterator iter;
|
||||||
|
|
||||||
BITSET_FOR_EACH (iter, src, i, 0)
|
BITSET_FOR_EACH (iter, src, index, 0)
|
||||||
{
|
{
|
||||||
printf ("%lu ", (unsigned long int) i);
|
printf ("%ld ", index);
|
||||||
};
|
};
|
||||||
*/
|
*/
|
||||||
#define BITSET_FOR_EACH(ITER, BSET, INDEX, MIN) \
|
#define BITSET_FOR_EACH(ITER, BSET, INDEX, MIN) \
|
||||||
for (ITER.next = (MIN), ITER.num = BITSET_LIST_SIZE; \
|
for (ITER.next = (MIN), ITER.num = BITSET_LIST_SIZE; \
|
||||||
(ITER.num == BITSET_LIST_SIZE) \
|
(ITER.num == BITSET_LIST_SIZE) \
|
||||||
&& (ITER.num = bitset_list (BSET, ITER.list, \
|
&& (ITER.num = bitset_list (BSET, ITER.list, \
|
||||||
BITSET_LIST_SIZE, &ITER.next));) \
|
BITSET_LIST_SIZE, &ITER.next));) \
|
||||||
for (ITER.i = 0; \
|
for (ITER.i = 0; \
|
||||||
ITER.i < ITER.num && ((INDEX) = ITER.list[ITER.i], 1); \
|
ITER.i < ITER.num && ((INDEX) = ITER.list[ITER.i], 1); \
|
||||||
@@ -323,20 +330,20 @@ extern void bitset_dump (FILE *, bitset);
|
|||||||
|
|
||||||
|
|
||||||
/* Loop over all elements of BSET, in reverse order starting with
|
/* Loop over all elements of BSET, in reverse order starting with
|
||||||
MIN, setting INDEX to the index of each set bit. For example, the
|
MIN, setting INDEX to the index of each set bit. For example, the
|
||||||
following will print the bits set in a bitset in reverse order:
|
following will print the bits set in a bitset in reverse order:
|
||||||
|
|
||||||
bitset_bindex i;
|
bitset_bindex index;
|
||||||
bitset_iterator iter;
|
bitset_iterator iter;
|
||||||
|
|
||||||
BITSET_FOR_EACH_REVERSE (iter, src, i, 0)
|
BITSET_FOR_EACH_REVERSE (iter, src, index, 0)
|
||||||
{
|
{
|
||||||
printf ("%lu ", (unsigned long int) i);
|
printf ("%ld ", index);
|
||||||
};
|
};
|
||||||
*/
|
*/
|
||||||
#define BITSET_FOR_EACH_REVERSE(ITER, BSET, INDEX, MIN) \
|
#define BITSET_FOR_EACH_REVERSE(ITER, BSET, INDEX, MIN) \
|
||||||
for (ITER.next = (MIN), ITER.num = BITSET_LIST_SIZE; \
|
for (ITER.next = (MIN), ITER.num = BITSET_LIST_SIZE; \
|
||||||
(ITER.num == BITSET_LIST_SIZE) \
|
(ITER.num == BITSET_LIST_SIZE) \
|
||||||
&& (ITER.num = bitset_list_reverse (BSET, ITER.list, \
|
&& (ITER.num = bitset_list_reverse (BSET, ITER.list, \
|
||||||
BITSET_LIST_SIZE, &ITER.next));) \
|
BITSET_LIST_SIZE, &ITER.next));) \
|
||||||
for (ITER.i = 0; \
|
for (ITER.i = 0; \
|
||||||
@@ -367,27 +374,28 @@ extern void bitset_dump (FILE *, bitset);
|
|||||||
|
|
||||||
|
|
||||||
/* Release any memory tied up with bitsets. */
|
/* Release any memory tied up with bitsets. */
|
||||||
extern void bitset_release_memory (void);
|
extern void bitset_release_memory PARAMS ((void));
|
||||||
|
|
||||||
/* Enable bitset stats gathering. */
|
/* Enable bitset stats gathering. */
|
||||||
extern void bitset_stats_enable (void);
|
extern void bitset_stats_enable PARAMS ((void));
|
||||||
|
|
||||||
/* Disable bitset stats gathering. */
|
/* Disable bitset stats gathering. */
|
||||||
extern void bitset_stats_disable (void);
|
extern void bitset_stats_disable PARAMS ((void));
|
||||||
|
|
||||||
/* Read bitset stats file of accummulated stats. */
|
/* Read bitset stats file of accummulated stats. */
|
||||||
void bitset_stats_read (const char *file_name);
|
void bitset_stats_read PARAMS ((const char *filename));
|
||||||
|
|
||||||
/* Write bitset stats file of accummulated stats. */
|
/* Write bitset stats file of accummulated stats. */
|
||||||
void bitset_stats_write (const char *file_name);
|
void bitset_stats_write PARAMS ((const char *filename));
|
||||||
|
|
||||||
/* Dump bitset stats. */
|
/* Dump bitset stats. */
|
||||||
extern void bitset_stats_dump (FILE *);
|
extern void bitset_stats_dump PARAMS ((FILE *));
|
||||||
|
|
||||||
/* Function to debug bitset from debugger. */
|
/* Function to debug bitset from debugger. */
|
||||||
extern void debug_bitset (bitset);
|
extern void debug_bitset PARAMS ((bitset));
|
||||||
|
|
||||||
/* Function to debug bitset stats from debugger. */
|
/* Function to debug bitset stats from debugger. */
|
||||||
extern void debug_bitset_stats (void);
|
extern void debug_bitset_stats PARAMS ((void));
|
||||||
|
|
||||||
#endif /* _BITSET_H */
|
#endif /* _BITSET_H */
|
||||||
|
|
||||||
|
|||||||
+45
-39
@@ -1,12 +1,10 @@
|
|||||||
/* Bitset statistics.
|
/* Bitset statistics.
|
||||||
|
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||||
Copyright (C) 2002-2006, 2009-2011 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
@@ -15,30 +13,38 @@
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
/* This file is a wrapper bitset implementation for the other bitset
|
/* This file is a wrapper bitset implementation for the other bitset
|
||||||
implementations. It provides bitset compatibility checking and
|
implementations. It provides bitset compatibility checking and
|
||||||
statistics gathering without having to instrument the bitset
|
statistics gathering without having to instrument the bitset
|
||||||
implementations. When statistics gathering is enabled, the bitset
|
implementations. When statistics gathering is enabled, the bitset
|
||||||
operations get vectored through here and we then call the appropriate
|
operations get vectored through here and we then call the appropriate
|
||||||
routines. */
|
routines.
|
||||||
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
#include "bitset_stats.h"
|
#endif
|
||||||
|
|
||||||
#include "bbitset.h"
|
#include "bbitset.h"
|
||||||
#include "abitset.h"
|
#include "abitset.h"
|
||||||
#include "ebitset.h"
|
#include "ebitset.h"
|
||||||
#include "lbitset.h"
|
#include "lbitset.h"
|
||||||
#include "vbitset.h"
|
#include "vbitset.h"
|
||||||
|
#include "bitset_stats.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_GETTEXT_H
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#define _(Msgid) gettext (Msgid)
|
#define _(Msgid) gettext (Msgid)
|
||||||
|
#else
|
||||||
|
#define _(Msgid) Msgid
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Configuration macros. */
|
/* Configuration macros. */
|
||||||
#define BITSET_STATS_FILE "bitset.dat"
|
#define BITSET_STATS_FILE "bitset.dat"
|
||||||
@@ -48,29 +54,29 @@
|
|||||||
|
|
||||||
|
|
||||||
/* Accessor macros. */
|
/* Accessor macros. */
|
||||||
#define BITSET_STATS_ALLOCS_INC(TYPE) \
|
#define BITSET_STATS_ALLOCS_INC(TYPE) \
|
||||||
bitset_stats_info->types[(TYPE)].allocs++
|
bitset_stats_info->types[(TYPE)].allocs++
|
||||||
#define BITSET_STATS_FREES_INC(BSET) \
|
#define BITSET_STATS_FREES_INC(BSET) \
|
||||||
bitset_stats_info->types[BITSET_TYPE_ (BSET)].frees++
|
bitset_stats_info->types[BITSET_TYPE_ (BSET)].frees++
|
||||||
#define BITSET_STATS_SETS_INC(BSET) \
|
#define BITSET_STATS_SETS_INC(BSET) \
|
||||||
bitset_stats_info->types[BITSET_TYPE_ (BSET)].sets++
|
bitset_stats_info->types[BITSET_TYPE_ (BSET)].sets++
|
||||||
#define BITSET_STATS_CACHE_SETS_INC(BSET) \
|
#define BITSET_STATS_CACHE_SETS_INC(BSET) \
|
||||||
bitset_stats_info->types[BITSET_TYPE_ (BSET)].cache_sets++
|
bitset_stats_info->types[BITSET_TYPE_ (BSET)].cache_sets++
|
||||||
#define BITSET_STATS_RESETS_INC(BSET) \
|
#define BITSET_STATS_RESETS_INC(BSET) \
|
||||||
bitset_stats_info->types[BITSET_TYPE_ (BSET)].resets++
|
bitset_stats_info->types[BITSET_TYPE_ (BSET)].resets++
|
||||||
#define BITSET_STATS_CACHE_RESETS_INC(BSET) \
|
#define BITSET_STATS_CACHE_RESETS_INC(BSET) \
|
||||||
bitset_stats_info->types[BITSET_TYPE_ (BSET)].cache_resets++
|
bitset_stats_info->types[BITSET_TYPE_ (BSET)].cache_resets++
|
||||||
#define BITSET_STATS_TESTS_INC(BSET) \
|
#define BITSET_STATS_TESTS_INC(BSET) \
|
||||||
bitset_stats_info->types[BITSET_TYPE_ (BSET)].tests++
|
bitset_stats_info->types[BITSET_TYPE_ (BSET)].tests++
|
||||||
#define BITSET_STATS_CACHE_TESTS_INC(BSET) \
|
#define BITSET_STATS_CACHE_TESTS_INC(BSET) \
|
||||||
bitset_stats_info->types[BITSET_TYPE_ (BSET)].cache_tests++
|
bitset_stats_info->types[BITSET_TYPE_ (BSET)].cache_tests++
|
||||||
#define BITSET_STATS_LISTS_INC(BSET) \
|
#define BITSET_STATS_LISTS_INC(BSET) \
|
||||||
bitset_stats_info->types[BITSET_TYPE_ (BSET)].lists++
|
bitset_stats_info->types[BITSET_TYPE_ (BSET)].lists++
|
||||||
#define BITSET_STATS_LIST_COUNTS_INC(BSET, I) \
|
#define BITSET_STATS_LIST_COUNTS_INC(BSET, I) \
|
||||||
bitset_stats_info->types[BITSET_TYPE_ (BSET)].list_counts[(I)]++
|
bitset_stats_info->types[BITSET_TYPE_ (BSET)].list_counts[(I)]++
|
||||||
#define BITSET_STATS_LIST_SIZES_INC(BSET, I) \
|
#define BITSET_STATS_LIST_SIZES_INC(BSET, I) \
|
||||||
bitset_stats_info->types[BITSET_TYPE_ (BSET)].list_sizes[(I)]++
|
bitset_stats_info->types[BITSET_TYPE_ (BSET)].list_sizes[(I)]++
|
||||||
#define BITSET_STATS_LIST_DENSITY_INC(BSET, I) \
|
#define BITSET_STATS_LIST_DENSITY_INC(BSET, I) \
|
||||||
bitset_stats_info->types[BITSET_TYPE_ (BSET)].list_density[(I)]++
|
bitset_stats_info->types[BITSET_TYPE_ (BSET)].list_density[(I)]++
|
||||||
|
|
||||||
|
|
||||||
@@ -158,8 +164,8 @@ bitset_log_histogram_print (FILE *file, const char *name, const char *msg,
|
|||||||
for (; i < n_bins; i++)
|
for (; i < n_bins; i++)
|
||||||
fprintf (file, "%*lu-%lu\t%8u (%5.1f%%)\n",
|
fprintf (file, "%*lu-%lu\t%8u (%5.1f%%)\n",
|
||||||
max_width - ((unsigned int) (0.30103 * (i) + 0.9999) + 1),
|
max_width - ((unsigned int) (0.30103 * (i) + 0.9999) + 1),
|
||||||
1UL << (i - 1),
|
(unsigned long) 1 << (i - 1),
|
||||||
(1UL << i) - 1,
|
((unsigned long) 1 << i) - 1,
|
||||||
bins[i],
|
bins[i],
|
||||||
(100.0 * bins[i]) / total);
|
(100.0 * bins[i]) / total);
|
||||||
}
|
}
|
||||||
@@ -239,17 +245,17 @@ bitset_stats_disable (void)
|
|||||||
|
|
||||||
/* Read bitset statistics file. */
|
/* Read bitset statistics file. */
|
||||||
void
|
void
|
||||||
bitset_stats_read (const char *file_name)
|
bitset_stats_read (const char *filename)
|
||||||
{
|
{
|
||||||
FILE *file;
|
FILE *file;
|
||||||
|
|
||||||
if (!bitset_stats_info)
|
if (!bitset_stats_info)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!file_name)
|
if (!filename)
|
||||||
file_name = BITSET_STATS_FILE;
|
filename = BITSET_STATS_FILE;
|
||||||
|
|
||||||
file = fopen (file_name, "r");
|
file = fopen (filename, "r");
|
||||||
if (file)
|
if (file)
|
||||||
{
|
{
|
||||||
if (fread (&bitset_stats_info_data, sizeof (bitset_stats_info_data),
|
if (fread (&bitset_stats_info_data, sizeof (bitset_stats_info_data),
|
||||||
@@ -269,17 +275,17 @@ bitset_stats_read (const char *file_name)
|
|||||||
|
|
||||||
/* Write bitset statistics file. */
|
/* Write bitset statistics file. */
|
||||||
void
|
void
|
||||||
bitset_stats_write (const char *file_name)
|
bitset_stats_write (const char *filename)
|
||||||
{
|
{
|
||||||
FILE *file;
|
FILE *file;
|
||||||
|
|
||||||
if (!bitset_stats_info)
|
if (!bitset_stats_info)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!file_name)
|
if (!filename)
|
||||||
file_name = BITSET_STATS_FILE;
|
filename = BITSET_STATS_FILE;
|
||||||
|
|
||||||
file = fopen (file_name, "w");
|
file = fopen (filename, "w");
|
||||||
if (file)
|
if (file)
|
||||||
{
|
{
|
||||||
if (fwrite (&bitset_stats_info_data, sizeof (bitset_stats_info_data),
|
if (fwrite (&bitset_stats_info_data, sizeof (bitset_stats_info_data),
|
||||||
@@ -694,32 +700,32 @@ bitset_stats_init (bitset bset, bitset_bindex n_bits, enum bitset_type type)
|
|||||||
we are a wrapper over. */
|
we are a wrapper over. */
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
default:
|
|
||||||
abort ();
|
|
||||||
|
|
||||||
case BITSET_ARRAY:
|
case BITSET_ARRAY:
|
||||||
bytes = abitset_bytes (n_bits);
|
bytes = abitset_bytes (n_bits);
|
||||||
sbset = xcalloc (1, bytes);
|
sbset = (bitset) xcalloc (1, bytes);
|
||||||
abitset_init (sbset, n_bits);
|
abitset_init (sbset, n_bits);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BITSET_LIST:
|
case BITSET_LIST:
|
||||||
bytes = lbitset_bytes (n_bits);
|
bytes = lbitset_bytes (n_bits);
|
||||||
sbset = xcalloc (1, bytes);
|
sbset = (bitset) xcalloc (1, bytes);
|
||||||
lbitset_init (sbset, n_bits);
|
lbitset_init (sbset, n_bits);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BITSET_TABLE:
|
case BITSET_TABLE:
|
||||||
bytes = ebitset_bytes (n_bits);
|
bytes = ebitset_bytes (n_bits);
|
||||||
sbset = xcalloc (1, bytes);
|
sbset = (bitset) xcalloc (1, bytes);
|
||||||
ebitset_init (sbset, n_bits);
|
ebitset_init (sbset, n_bits);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BITSET_VARRAY:
|
case BITSET_VARRAY:
|
||||||
bytes = vbitset_bytes (n_bits);
|
bytes = vbitset_bytes (n_bits);
|
||||||
sbset = xcalloc (1, bytes);
|
sbset = (bitset) xcalloc (1, bytes);
|
||||||
vbitset_init (sbset, n_bits);
|
vbitset_init (sbset, n_bits);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
abort ();
|
||||||
}
|
}
|
||||||
|
|
||||||
bset->s.bset = sbset;
|
bset->s.bset = sbset;
|
||||||
|
|||||||
+16
-16
@@ -1,21 +1,20 @@
|
|||||||
/* Functions to support bitset statistics.
|
/* Functions to support bitset statistics.
|
||||||
|
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
|
||||||
Copyright (C) 2002-2004, 2009-2011 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#ifndef _BITSET_STATS_H
|
#ifndef _BITSET_STATS_H
|
||||||
#define _BITSET_STATS_H
|
#define _BITSET_STATS_H
|
||||||
@@ -24,10 +23,11 @@
|
|||||||
|
|
||||||
extern bool bitset_stats_enabled;
|
extern bool bitset_stats_enabled;
|
||||||
|
|
||||||
extern enum bitset_type bitset_stats_type_get (bitset);
|
extern enum bitset_type bitset_stats_type_get PARAMS ((bitset));
|
||||||
|
|
||||||
extern size_t bitset_stats_bytes (void);
|
extern size_t bitset_stats_bytes PARAMS ((void));
|
||||||
|
|
||||||
extern bitset bitset_stats_init (bitset, bitset_bindex, enum bitset_type);
|
extern bitset bitset_stats_init PARAMS ((bitset, bitset_bindex,
|
||||||
|
enum bitset_type));
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+1
-3
@@ -1,7 +1,5 @@
|
|||||||
/* Bitset vectors.
|
/* Bitset vectors.
|
||||||
|
Copyright (C) 2001, 2002, 2004, 2006 Free Software Foundation, Inc.
|
||||||
Copyright (C) 2001-2002, 2004, 2006, 2009-2011 Free Software
|
|
||||||
Foundation, Inc.
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+1
-3
@@ -1,7 +1,5 @@
|
|||||||
/* Bitset vectors.
|
/* Bitset vectors.
|
||||||
|
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
|
||||||
Copyright (C) 2002, 2004, 2009-2011 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
Contributed by Akim Demaille (akim@freefriends.org).
|
Contributed by Akim Demaille (akim@freefriends.org).
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
|||||||
+21
-18
@@ -1,26 +1,29 @@
|
|||||||
/* Bitset vectors.
|
/* Bitset vectors.
|
||||||
|
Copyright (C) 2001, 2002 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Copyright (C) 2001-2002, 2004-2006, 2009-2011 Free Software
|
This file is part of GCC.
|
||||||
Foundation, Inc.
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
GCC is free software; you can redistribute it and/or modify it under
|
||||||
it under the terms of the GNU General Public License as published by
|
the terms of the GNU General Public License as published by the Free
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
Software Foundation; either version 2, or (at your option) any later
|
||||||
(at your option) any later version.
|
version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
GNU General Public License for more details.
|
for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
along with GCC; see the file COPYING. If not, write to the Free
|
||||||
|
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
||||||
|
02111-1307, USA. */
|
||||||
|
|
||||||
#include <config.h>
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
#include "bitsetv.h"
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include "bitsetv.h"
|
||||||
|
|
||||||
|
|
||||||
/* Create a vector of N_VECS bitsets, each of N_BITS, and of
|
/* Create a vector of N_VECS bitsets, each of N_BITS, and of
|
||||||
@@ -44,7 +47,7 @@ bitsetv_alloc (bitset_bindex n_vecs, bitset_bindex n_bits,
|
|||||||
/* Allocate vector table at head of bitset array. */
|
/* Allocate vector table at head of bitset array. */
|
||||||
vector_bytes = (n_vecs + 1) * sizeof (bitset) + bytes - 1;
|
vector_bytes = (n_vecs + 1) * sizeof (bitset) + bytes - 1;
|
||||||
vector_bytes -= vector_bytes % bytes;
|
vector_bytes -= vector_bytes % bytes;
|
||||||
bsetv = xcalloc (1, vector_bytes + bytes * n_vecs);
|
bsetv = (bitset *) xcalloc (1, vector_bytes + bytes * n_vecs);
|
||||||
|
|
||||||
for (i = 0; i < n_vecs; i++)
|
for (i = 0; i < n_vecs; i++)
|
||||||
{
|
{
|
||||||
@@ -146,7 +149,7 @@ bitsetv_dump (FILE *file, char const *title, char const *subtitle,
|
|||||||
fprintf (file, "%s\n", title);
|
fprintf (file, "%s\n", title);
|
||||||
for (i = 0; bsetv[i]; i++)
|
for (i = 0; bsetv[i]; i++)
|
||||||
{
|
{
|
||||||
fprintf (file, "%s %lu\n", subtitle, (unsigned long int) i);
|
fprintf (file, "%s %lu\n", subtitle, (unsigned long) i);
|
||||||
bitset_dump (file, bsetv[i]);
|
bitset_dump (file, bsetv[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,7 +164,7 @@ debug_bitsetv (bitsetv bsetv)
|
|||||||
|
|
||||||
for (i = 0; bsetv[i]; i++)
|
for (i = 0; bsetv[i]; i++)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "%lu: ", (unsigned long int) i);
|
fprintf (stderr, "%lu: ", (unsigned long) i);
|
||||||
debug_bitset (bsetv[i]);
|
debug_bitset (bsetv[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+24
-22
@@ -1,21 +1,20 @@
|
|||||||
/* Bitset vectors.
|
/* Bitset vectors.
|
||||||
|
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||||
Copyright (C) 2002, 2004, 2009-2011 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#ifndef _BITSETV_H
|
#ifndef _BITSETV_H
|
||||||
#define _BITSETV_H
|
#define _BITSETV_H
|
||||||
@@ -26,35 +25,38 @@ typedef bitset * bitsetv;
|
|||||||
|
|
||||||
/* Create a vector of N_VECS bitsets, each of N_BITS, and of
|
/* Create a vector of N_VECS bitsets, each of N_BITS, and of
|
||||||
type TYPE. */
|
type TYPE. */
|
||||||
extern bitsetv bitsetv_alloc (bitset_bindex, bitset_bindex, enum bitset_type);
|
extern bitsetv bitsetv_alloc PARAMS ((bitset_bindex, bitset_bindex,
|
||||||
|
enum bitset_type));
|
||||||
|
|
||||||
/* Create a vector of N_VECS bitsets, each of N_BITS, and with
|
/* Create a vector of N_VECS bitsets, each of N_BITS, and with
|
||||||
attribute hints specified by ATTR. */
|
attribute hints specified by ATTR. */
|
||||||
extern bitsetv bitsetv_create (bitset_bindex, bitset_bindex, unsigned int);
|
extern bitsetv bitsetv_create PARAMS ((bitset_bindex, bitset_bindex,
|
||||||
|
unsigned int));
|
||||||
|
|
||||||
/* Free vector of bitsets. */
|
/* Free vector of bitsets. */
|
||||||
extern void bitsetv_free (bitsetv);
|
extern void bitsetv_free PARAMS ((bitsetv));
|
||||||
|
|
||||||
/* Zero vector of bitsets. */
|
/* Zero vector of bitsets. */
|
||||||
extern void bitsetv_zero (bitsetv);
|
extern void bitsetv_zero PARAMS ((bitsetv));
|
||||||
|
|
||||||
/* Set vector of bitsets. */
|
/* Set vector of bitsets. */
|
||||||
extern void bitsetv_ones (bitsetv);
|
extern void bitsetv_ones PARAMS ((bitsetv));
|
||||||
|
|
||||||
/* Given a vector BSETV of N bitsets of size N, modify its contents to
|
/* Given a vector BSETV of N bitsets of size N, modify its contents to
|
||||||
be the transitive closure of what was given. */
|
be the transitive closure of what was given. */
|
||||||
extern void bitsetv_transitive_closure (bitsetv);
|
extern void bitsetv_transitive_closure PARAMS ((bitsetv));
|
||||||
|
|
||||||
/* Given a vector BSETV of N bitsets of size N, modify its contents to
|
/* Given a vector BSETV of N bitsets of size N, modify its contents to
|
||||||
be the reflexive transitive closure of what was given. This is
|
be the reflexive transitive closure of what was given. This is
|
||||||
the same as transitive closure but with all bits on the diagonal
|
the same as transitive closure but with all bits on the diagonal
|
||||||
of the bit matrix set. */
|
of the bit matrix set. */
|
||||||
extern void bitsetv_reflexive_transitive_closure (bitsetv);
|
extern void bitsetv_reflexive_transitive_closure PARAMS ((bitsetv));
|
||||||
|
|
||||||
/* Dump vector of bitsets. */
|
/* Dump vector of bitsets. */
|
||||||
extern void bitsetv_dump (FILE *, const char *, const char *, bitsetv);
|
extern void bitsetv_dump PARAMS ((FILE *, const char *,
|
||||||
|
const char *, bitsetv));
|
||||||
|
|
||||||
/* Function to debug vector of bitsets from debugger. */
|
/* Function to debug vector of bitsets from debugger. */
|
||||||
extern void debug_bitsetv (bitsetv);
|
extern void debug_bitsetv PARAMS ((bitsetv));
|
||||||
|
|
||||||
#endif /* _BITSETV_H */
|
#endif /* _BITSETV_H */
|
||||||
|
|||||||
+36
-30
@@ -1,12 +1,10 @@
|
|||||||
/* Functions to support expandable bitsets.
|
/* Functions to support expandable bitsets.
|
||||||
|
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
|
||||||
Copyright (C) 2002-2006, 2009-2011 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
@@ -15,12 +13,15 @@
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "ebitset.h"
|
#include "ebitset.h"
|
||||||
|
|
||||||
#include "obstack.h"
|
#include "obstack.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -51,7 +52,7 @@
|
|||||||
|
|
||||||
/* Number of bits stored in each element. */
|
/* Number of bits stored in each element. */
|
||||||
#define EBITSET_ELT_BITS \
|
#define EBITSET_ELT_BITS \
|
||||||
((unsigned int) (EBITSET_ELT_WORDS * BITSET_WORD_BITS))
|
((unsigned) (EBITSET_ELT_WORDS * BITSET_WORD_BITS))
|
||||||
|
|
||||||
/* Ebitset element. We use an array of bits. */
|
/* Ebitset element. We use an array of bits. */
|
||||||
typedef struct ebitset_elt_struct
|
typedef struct ebitset_elt_struct
|
||||||
@@ -114,13 +115,15 @@ static ebitset_elt *ebitset_free_list; /* Free list of bitset elements. */
|
|||||||
((BSET)->b.cindex = (EINDEX) * EBITSET_ELT_WORDS, \
|
((BSET)->b.cindex = (EINDEX) * EBITSET_ELT_WORDS, \
|
||||||
(BSET)->b.cdata = EBITSET_WORDS (EBITSET_ELTS (BSET) [EINDEX]))
|
(BSET)->b.cdata = EBITSET_WORDS (EBITSET_ELTS (BSET) [EINDEX]))
|
||||||
|
|
||||||
#undef min
|
|
||||||
#undef max
|
|
||||||
#define min(a, b) ((a) > (b) ? (b) : (a))
|
#define min(a, b) ((a) > (b) ? (b) : (a))
|
||||||
#define max(a, b) ((a) > (b) ? (a) : (b))
|
#define max(a, b) ((a) > (b) ? (a) : (b))
|
||||||
|
|
||||||
|
|
||||||
static bitset_bindex
|
static bitset_bindex
|
||||||
ebitset_resize (bitset src, bitset_bindex n_bits)
|
ebitset_resize (src, n_bits)
|
||||||
|
bitset src;
|
||||||
|
bitset_bindex n_bits;
|
||||||
{
|
{
|
||||||
bitset_windex oldsize;
|
bitset_windex oldsize;
|
||||||
bitset_windex newsize;
|
bitset_windex newsize;
|
||||||
@@ -135,7 +138,7 @@ ebitset_resize (bitset src, bitset_bindex n_bits)
|
|||||||
{
|
{
|
||||||
bitset_windex size;
|
bitset_windex size;
|
||||||
|
|
||||||
/* The bitset needs to grow. If we already have enough memory
|
/* The bitset needs to grow. If we already have enough memory
|
||||||
allocated, then just zero what we need. */
|
allocated, then just zero what we need. */
|
||||||
if (newsize > EBITSET_ASIZE (src))
|
if (newsize > EBITSET_ASIZE (src))
|
||||||
{
|
{
|
||||||
@@ -148,13 +151,13 @@ ebitset_resize (bitset src, bitset_bindex n_bits)
|
|||||||
size = newsize;
|
size = newsize;
|
||||||
else
|
else
|
||||||
size = newsize + newsize / 4;
|
size = newsize + newsize / 4;
|
||||||
|
|
||||||
EBITSET_ELTS (src)
|
EBITSET_ELTS (src)
|
||||||
= realloc (EBITSET_ELTS (src), size * sizeof (ebitset_elt *));
|
= realloc (EBITSET_ELTS (src), size * sizeof (ebitset_elt *));
|
||||||
EBITSET_ASIZE (src) = size;
|
EBITSET_ASIZE (src) = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset (EBITSET_ELTS (src) + oldsize, 0,
|
memset (EBITSET_ELTS (src) + oldsize, 0,
|
||||||
(newsize - oldsize) * sizeof (ebitset_elt *));
|
(newsize - oldsize) * sizeof (ebitset_elt *));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -209,13 +212,15 @@ ebitset_elt_alloc (void)
|
|||||||
#define OBSTACK_CHUNK_FREE free
|
#define OBSTACK_CHUNK_FREE free
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ! defined __GNUC__ || __GNUC__ < 2
|
#if !defined(__GNUC__) || (__GNUC__ < 2)
|
||||||
#define __alignof__(type) 0
|
#define __alignof__(type) 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
obstack_specify_allocation (&ebitset_obstack, OBSTACK_CHUNK_SIZE,
|
obstack_specify_allocation (&ebitset_obstack, OBSTACK_CHUNK_SIZE,
|
||||||
__alignof__ (ebitset_elt),
|
__alignof__ (ebitset_elt),
|
||||||
|
(void *(*)PARAMS ((long)))
|
||||||
OBSTACK_CHUNK_ALLOC,
|
OBSTACK_CHUNK_ALLOC,
|
||||||
|
(void (*)PARAMS ((void *)))
|
||||||
OBSTACK_CHUNK_FREE);
|
OBSTACK_CHUNK_FREE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -321,9 +326,6 @@ ebitset_elt_find (bitset bset, bitset_bindex bindex,
|
|||||||
|
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
default:
|
|
||||||
abort ();
|
|
||||||
|
|
||||||
case EBITSET_FIND:
|
case EBITSET_FIND:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@@ -339,6 +341,9 @@ ebitset_elt_find (bitset bset, bitset_bindex bindex,
|
|||||||
|
|
||||||
case EBITSET_SUBST:
|
case EBITSET_SUBST:
|
||||||
return &ebitset_zero_elts[0];
|
return &ebitset_zero_elts[0];
|
||||||
|
|
||||||
|
default:
|
||||||
|
abort ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -833,14 +838,15 @@ ebitset_list (bitset bset, bitset_bindex *list,
|
|||||||
|
|
||||||
/* Ensure that any unused bits within the last element are clear. */
|
/* Ensure that any unused bits within the last element are clear. */
|
||||||
static inline void
|
static inline void
|
||||||
ebitset_unused_clear (bitset dst)
|
ebitset_unused_clear (dst)
|
||||||
|
bitset dst;
|
||||||
{
|
{
|
||||||
unsigned int last_bit;
|
unsigned int last_bit;
|
||||||
bitset_bindex n_bits;
|
bitset_bindex n_bits;
|
||||||
|
|
||||||
n_bits = BITSET_NBITS_ (dst);
|
n_bits = BITSET_NBITS_ (dst);
|
||||||
last_bit = n_bits % EBITSET_ELT_BITS;
|
last_bit = n_bits % EBITSET_ELT_BITS;
|
||||||
|
|
||||||
if (last_bit)
|
if (last_bit)
|
||||||
{
|
{
|
||||||
bitset_windex eindex;
|
bitset_windex eindex;
|
||||||
@@ -848,20 +854,20 @@ ebitset_unused_clear (bitset dst)
|
|||||||
ebitset_elt *elt;
|
ebitset_elt *elt;
|
||||||
|
|
||||||
elts = EBITSET_ELTS (dst);
|
elts = EBITSET_ELTS (dst);
|
||||||
|
|
||||||
eindex = n_bits / EBITSET_ELT_BITS;
|
eindex = n_bits / EBITSET_ELT_BITS;
|
||||||
|
|
||||||
elt = elts[eindex];
|
elt = elts[eindex];
|
||||||
if (elt)
|
if (elt)
|
||||||
{
|
{
|
||||||
bitset_windex windex;
|
bitset_windex windex;
|
||||||
bitset_windex woffset;
|
bitset_windex woffset;
|
||||||
bitset_word *srcp = EBITSET_WORDS (elt);
|
bitset_word *srcp = EBITSET_WORDS (elt);
|
||||||
|
|
||||||
windex = n_bits / BITSET_WORD_BITS;
|
windex = n_bits / BITSET_WORD_BITS;
|
||||||
woffset = eindex * EBITSET_ELT_WORDS;
|
woffset = eindex * EBITSET_ELT_WORDS;
|
||||||
|
|
||||||
srcp[windex - woffset] &= ((bitset_word) 1 << last_bit) - 1;
|
srcp[windex - woffset] &= ((bitset_word) 1 << last_bit) - 1;
|
||||||
windex++;
|
windex++;
|
||||||
for (; (windex - woffset) < EBITSET_ELT_WORDS; windex++)
|
for (; (windex - woffset) < EBITSET_ELT_WORDS; windex++)
|
||||||
srcp[windex - woffset] = 0;
|
srcp[windex - woffset] = 0;
|
||||||
@@ -1089,9 +1095,6 @@ ebitset_op3_cmp (bitset dst, bitset src1, bitset src2, enum bitset_ops op)
|
|||||||
dstp = EBITSET_WORDS (delt);
|
dstp = EBITSET_WORDS (delt);
|
||||||
switch (op)
|
switch (op)
|
||||||
{
|
{
|
||||||
default:
|
|
||||||
abort ();
|
|
||||||
|
|
||||||
case BITSET_OP_OR:
|
case BITSET_OP_OR:
|
||||||
for (i = 0; i < EBITSET_ELT_WORDS; i++, dstp++)
|
for (i = 0; i < EBITSET_ELT_WORDS; i++, dstp++)
|
||||||
{
|
{
|
||||||
@@ -1143,6 +1146,9 @@ ebitset_op3_cmp (bitset dst, bitset src1, bitset src2, enum bitset_ops op)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
abort ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ebitset_elt_zero_p (delt))
|
if (!ebitset_elt_zero_p (delt))
|
||||||
|
|||||||
+16
-17
@@ -1,31 +1,30 @@
|
|||||||
/* Functions to support ebitsets.
|
/* Functions to support ebitsets.
|
||||||
|
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||||
Copyright (C) 2002, 2004, 2009-2011 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#ifndef _EBITSET_H
|
#ifndef _EBITSET_H
|
||||||
#define _EBITSET_H
|
#define _EBITSET_H
|
||||||
|
|
||||||
#include "bitset.h"
|
#include "bitset.h"
|
||||||
|
|
||||||
extern size_t ebitset_bytes (bitset_bindex);
|
extern size_t ebitset_bytes PARAMS ((bitset_bindex));
|
||||||
|
|
||||||
extern bitset ebitset_init (bitset, bitset_bindex);
|
extern bitset ebitset_init PARAMS ((bitset, bitset_bindex));
|
||||||
|
|
||||||
extern void ebitset_release_memory (void);
|
extern void ebitset_release_memory PARAMS ((void));
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* get-errno.c - get and set errno.
|
/* get-errno.c - get and set errno.
|
||||||
|
|
||||||
Copyright (C) 2002, 2006, 2009-2011 Free Software Foundation, Inc.
|
Copyright (C) 2002, 2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user